New to Lua, not to Garry's Mod. Recently I've been getting really, really annoyed with the toolgun sound. It's one of those things where I just keep thinking about how annoying it is, and then the cycle just doesn't stop.
I figured this might be a good opportunity to do a small Lua project while solving a practical problem I have.
Here's what I have so far
[code]
toolsounds = "weapons/airboat/airboat_gun_lastshot2.wav;weapons/airboat/airboat_gun_lastshot1.wav"
hook.Add("EntityEmitSound", "NoTool", function(data)
for k, v in pairs(string.Explode(";", toolsounds)) do
if v == data["SoundName"] then
return false
end
end
end)
[/code]
This sort've works when run clientside. You can no longer hear your own toolgun but you still hear the toolgun sounds of other players. And when run on serverside, it's the opposite. You can hear your own toolgun sound but not others. I get how this makes sense, but in the end it's MY client that is playing the sound so I should be able to stop the sound from playing, right?
I mean, getting really down and dirty could I like, decompile the sounds and physically replace/remove the toolgun sounds or some shit.
Anyone have any brilliant ideas? Would really like to solve this problem, and preferably learn some things along the way.
Thanks.
Make it shared?
So both client and server runs it, therefore eliminating all sound of toolgun?
[QUOTE=AnonTakesOver;45560668]Make it shared?
So both client and server runs it, therefore eliminating all sound of toolgun?[/QUOTE]
I was hoping to only disable the sound for individual clients.
[QUOTE=Phatso420;45560795]I was hoping to only disable the sound for individual clients.[/QUOTE]
You can't do that yet because EntityEmitSound is still a somewhat experimental hook so it is pretty limited right now. I was planning to add a clientside only hook that catches sounds right before they are played on your client, but it won't be there until next update.
Sorry, you need to Log In to post a reply to this thread.