Think this would work?

Wondering if this would work? Just something I thought of for a gamemode. Btw some of this is riped out of ulx.

[lua]
function BlockVoice( ply, bind, pressed )
if ply:Team() == TEAM_PRISONER_DEAD or ply:Team() == TEAM_Guard_DEAD then
if string.find( bind, “voicerecord” ) then return false end
local function gagCheck()
RunConsoleCommand( “-voicerecord” )
end
timer.Create( “GagLocalPlayer”, 0.1, 0, gagCheck )
RunConsoleCommand( “-voicerecord” )
else
timer.Destroy( “GagLocalPlayer”)
end
end
hook.Add(“PlayerBindPress”, “VoiceMute”, BlockVoice)
[/lua]

i think it would be better to use
**[Player.IsMuted

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Player.IsMuted)**
**[Player.SetMuted

http://wiki.garrysmod.com/favicon.ico](wiki.garrysmod.com/?title=Player.SetMuted)**
So your not overflowing clients with a command

You could bypass a block if it was on the clientside, like you said. It’s better to block it on the server.

Not sure if this is what you want, but I use this to handle voice chat:

I thought those were long gone and lost hope. I’m looking to stop script kiddies just the regular players. Server with 50 slots and all the dead players want to talk.

[lua]
function GM:PlayerCanHearPlayersVoice(pl1, pl2)
if !pl2:Alive() then return false end

return true

end
[/lua]

[lua]
function GM:PlayerCanHearPlayersVoice(pl1, pl2)
if !pl2:Alive() or !pl1:Alive() then return false end
return true
end
[/lua]
:eng101:

He’s right. Unfortunately when we wrote the gag command into ULX, either those didn’t work or weren’t published on the wiki yet (both? :stuck_out_tongue: )
I’ve been asked to review and improve our SVN code regarding Gag.

Dave/Gbps idea (server-side) seems a better way to do it at first glance.