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).
Syntax
Section titled “Syntax”SetPlayerVoiceMuted(pid, muted)| Parameter | Type | |
|---|---|---|
pid |
number | the player |
muted |
boolean | true mutes, false lifts it |
Returns
Section titled “Returns”boolean: false for an unknown player
Example
Section titled “Example”-- /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 endendSee also
Section titled “See also”IsPlayerVoiceMuted · SetPlayerVoiceMutedFor · SetPlayerVoiceDeaf · the Voice chat group of the index
