Sounds being overlayed

im trying to make a flamethrower swep for teh lols, and im having a problem with the Sounds.
the swep works perfectly fine with the sounds and such… but the sounds dont STOP

this code is SUPPOSED to stop the sound either when reloading, or when you release the fire or secondary fire. but its not doing anything! therefore overlaying the sound over and over!

function SWEP:Reload()
self.Weapon:DefaultReload( ACT_VM_RELOAD )

function SWEP:Think()

if self.Owner:KeyReleased(IN_ATTACK) or self.Owner:KeyRelease(IN_ATTACK2) then


Why exactly isnt the self:StopSounds() working?? did garry change this too?

Use this instead. Much more useful since you can change the pitch/ volume of without making a new sound.

i see its a swep so… put this in the SWEP:Initialize()

self.<<Some unique name>> = CreateSound(self, Sound("<<Your sound>>"))

It just creates a sound it doesnt play it. To play and stop it use this

self.<<A unique name you've given earlier>>:Stop()
self.<<A unique name you've given earlier>>:Play()

Also… for some reason sometimes in order for it to play correctly you have to stop the sound before playing… so when ever you want to play it use

self.<<A unique name you've given earlier>>:Stop() self.<<A unique name you've given earlier>>:Play()

For more info like changing pitch/sound search the wiki.

im not exactly trying to change pitch or sound, i simply want the sound to stop playing when you release the PRimary or secondary attack as well as the reload

Didint i just tell you how?.. -.-

To tell the truth that line of code confuses me.

function SWEP:Initialize()
self:SetWeaponHoldType( self.HoldType )


Can you try and plug it in for me?
Have the unique name be anything you want.

Its not really rocket science… But i see this is your first/second swep? So here’s how the initialize function should be judging by the code you given:[LUA]function SWEP:Initialize()
–yes the name can be anything you want… i suggest rs_<<weapons name>>. Like if your sweps name is ar5
self.rs_ar5 = CreateSound(self, Sound("<<The Reload Sound you want>>"))
end[/LUA]When ever you want to play the sound just put in

self.rs_ar5:Stop() self.rs_ar5:Play()

And when you want to stop ( i suggest you also paste this into SWEP:Holster())