Issue with stopping sounds serverside

I’m trying to find an easy way that I can stop all sounds that players in my server are hearing via a command I can use. I used to use various admin cexec with stop all sounds, but that doesn’t work anymore after one of the updates. I also had exosounds which worked pretty good for that and it appears to not work that way for what I assume are the same reasons. I had made my own lua to stop all sounds that players were hearing but after some tests, it’s only working on me and no one else. Help?

To perfectly clarify, I need something that can be triggered by an admin that will stop all sounds all clients are hearing.

[lua]function StopSounds(pl)
if not pl:IsAdmin() then return end

for _,v in ipairs(player.GetAll()) do v:ConCommand("stopsounds") end


Like this?

That’s almost the same as what I made to do it. It’s executing on me, but no one else in my server. They all still hear sounds when I tell sounds to stop. When I specifically try to execute this on a client, it’s saying concommand blocked. Is there a way around this?

That’s probably because you’re running from the client. Run this command from the server.

If it says ConCommand is still blocked, try this:

function StopSounds(pl)
if not pl:IsAdmin() then return end

for _,v in ipairs(player.GetAll()) do v:SendLua("RunConsoleCommand(\"stopsounds\")") end


Or if everything else fails you could send a usermessage to the players that would trigger RunConsoleCommand clientside. But if the command is blocked in both ConCommand and SendLua then I don’t see it working either.

Try not trying to override the engine cmd ‘stopallsounds’. Engine cmd > Lua cmd.

Thank you everyone. I think from all that was said, I can find a way to make this work. Words appreciated.

Wait, there’s actually a “stopallsounds” command? I never knew.


] stopallsounds
Unknown command "stopallsounds"