• Help with swep sound binding to a key.
    3 replies, posted
Hi I'm making a swep and i need a sound to play when pressing the key "r", Is there a way to do this? If so, could you please give me the code?
Hi, assuming you mean the Reload key, play the sound under the SWEP:Reload() event
So this would work? function SWEP:Reload() self:EmitSound("Weapon_AR2.Single") end
[QUOTE=Frozendairy;44433895]So this would work? function SWEP:Reload() self:EmitSound("Weapon_AR2.Single") end[/QUOTE] Thing is, that emits the sound everytime the game detects the R button being pressed, whether reloading or not. If you want a reload sound, try and find the event specific to the action of the gun, and use localized sounds. For example, if you want a sound that plays when you pull a bolt back on the gun, for example, find the specific event name for that action and localise the sound. [code]sound.Add({ name = "CustomWeapon.Bolt", -- Replace this with the event name channel = CHAN_WEAPON, volume = 1.0, sound = "weapons/Custom Sounds/Boltback.wav" -- Replace with sound name, from sounds/ })[/code]
Sorry, you need to Log In to post a reply to this thread.