Ok so on the ttt server that i play on, there are a lot of songs and sounds being played and it can be offputting and stop you from hearing important things so i want to include a feature to allow players to use the “stopsound” command by pressing F4. This is what i have at the moment, but it doesn’t do the job, anyone point me in the right direction?
[LUA]
function StopAllSound(ply, key)
if key == KEY_F4 then
ply:RunConsoleCommand(“stopsound”)
end
end
hook.Add( “KeyPress”, “KeyPressedHook”, StopAllSound )
[/LUA]
That won’t work because stopsound is clientside and its a console command. You can use GM:ShowSpare2 but you need to have a net message that sends the command to the client.