Skip to content

SetPlayerVoiceMuted

Nobody hears the player while muted.

Their voice frames are dropped at the server: a moderation lever (a gag). For one listener alone - a player who does not want to hear another - use SetPlayerVoiceMutedFor (the server’s /mute).

SetPlayerVoiceMuted(pid, muted)
Parameter Type
pid number the player
muted boolean true mutes, false lifts it

boolean: false for an unknown player

-- /gag <name|id>: an admin silences a player for everyone (or lets them speak again)
function OnPlayerCommandText(pid, cmd, args)
if cmd == "gag" and IsPlayerAdmin(pid) then
local target, why = GetPlayerId(args)
if not target then
SendClientMessage(pid, COLOR_WHITE, why or "/gag <name|id>")
return true
end
SetPlayerVoiceMuted(target, not IsPlayerVoiceMuted(target))
SendClientMessage(pid, COLOR_WHITE, GetPlayerName(target) .. (IsPlayerVoiceMuted(target) and " gagged" or " may speak again"))
return true
end
end

IsPlayerVoiceMuted · SetPlayerVoiceMutedFor · SetPlayerVoiceDeaf · the Voice chat group of the index