self:EmitSound reloading flaws? fixes?

I’ve recently made a swep with reload sounds using:



/*---------------------------------------------------------
Reload
---------------------------------------------------------*/
function SWEP:Reload()
self.Weapon:DefaultReload( ACT_VM_RELOAD )
self:EmitSound( "weapons/weapon_intervention/mw2_intervention_reload.wav" )
end

However, there are some drawbacks that I hope someone can tell me how to fix:
-Holding down the reload key will cause the reload sound to play verrrrrrryyyyy fast and sound weird

I have exactly the same problem

You should have some logic in there that prevents it from reloading when it’s not needed. Check the ammo count, etc.
Also, if you require the reload event for anything other than reloading, just add a variable for timing. Something like this.
[lua]
// it’s not time to reload again, so just bypass everything
if( self.NextReload > CurTime() ) then

return;

end

// next reload in 1/4th of a second.
self.NextReload = CurTime() + 0.25;

// do your reload code
self.Weapon:DefaultReload( ACT_VM_RELOAD );
self:EmitSound( “weapons/weapon_intervention/mw2_intervention_reload.wav” );
[/lua]
Just make sure you set self.NextReload to CurTime() in SWEP:Initialize().

Hey dude do you think you could take a look at this for me please.

http://www.facepunch.com/showthread.php?t=919729