• Play a sound before TTT C4's explosion if attempted disarm
    2 replies, posted
Hello there. I've been trying to make the TTT C4 have a delay of one second before exploding, and play a sound during that delay if someone attempted to disarm it and failed. ("WROOOOONG.") Though the only thing I managed to do so far is break the C4 in multiple possible ways. This is as close as I got to the wanted effect, though it plays at the same time as the explosion: [CODE] if self.DisarmCausedExplosion then r_inner = r_inner / 2.5 r_outer = r_outer / 2.5 sound.Play("darkfoxttt/darkfox_wrong4.wav", pos, 75, 100) end[/CODE] Any help would be really appreciated.
[url]https://github.com/garrynewman/garrysmod/blob/master/garrysmod/gamemodes/terrortown/entities/entities/ttt_c4/shared.lua#L397[/url] That's where they do the disarm, so what you could do is... [lua]self:SetExplodeTime(CurTime() + 1); -- Change the 0.01 to 1 (for a second)[/lua] And then right before that function add... [lua]self:EmitSound("darkfoxttt/darkfox_wrong4.wav", 100, 100); -- The C4 will emit this sound then, letting everyone know that, ha, he failed[/lua]
That worked! Thanks!
Sorry, you need to Log In to post a reply to this thread.