Hello everyone. I have been encountering problems with a script I am making for my PPSH-41. Basically, it’s primary firing sound is a loop. I want this loop to stop when Keydown(IN_ATTACK) is false (when I take my finger off mouse1). After that sound is stopped, I want another sound to play after it.
Here’s my current code (the looping sound is only stopping when magcount is 0):
if not sound_int then
gun = CreateSound( self.Owner, “weapons/loop/ostfrontppsh20.wav” )
sound_int = true
if self.Owner:KeyDown(IN_ATTACK) and self.Weapon:Clip1() > 0 and !self.dt.Running and !self.Owner:KeyDown(IN_USE) then gun:Play() sound_end = true else gun:Stop() if not self.Owner:KeyDown(IN_ATTACK) and sound_end then self.Owner:EmitSound(Sound("weapons/loop/cue22.wav")) sound_end = false end
By the way, this script is for the SWEP:PrimaryAttack Function.