I am developing a small SWEP, and I need a bit of help.
Currently when the user attacks using the SWEP, it will play two different sounds, each from its own selection.
-The sound emitted by the weapon itself is a random swing sound. (This sound is only intended to be heard by the weapon user)
-The sound emitted by the weapon owner is a taunt sound. (This sound is intended to be heard by everybody nearby)
In singleplayer this works no problem; you hear 1 of 2 different swing sounds, and 1 of 6 different taunt sounds.
But in multiplayer, the sound emitted by the owner of the weapon (in this case, the taunt sound) is emitted twice.
And it isn’t even the same sound that is emitted twice, it is 2 different sounds from that selection.
self.Weapon:EmitSound(“slash_0”…math.random(1, 2)…".wav") --Works fine in both singleplayer and multiplayer
local attack = math.random(1, 6)
self.Owner:EmitSound(“attack_0”…attack…".wav") --Plays two random sounds in multiplayer, but works as intended in singleplayer
self:SetNextPrimaryFire( CurTime() + self.Primary.Delay )
I think I have an idea as to why this happens but I can’t come up with a solution. Any ideas would be appreciated.
(If I choose to emit both of the sounds from the weapon, they won’t be heard in multiplayer (I believe, I may be mistaken) and they will cut eachother off)