SetPlayerVoiceMutedFor
One player no longer hears another - for that player alone.
listener stops hearing talker (false: hears them again); everyone else still hears the talker. It is what the
server’s /mute does, for a mode that offers its own - a command of its own name, a button on a page, a mute by the id
the mode shows instead of a name plate. The listener’s scoreboard marks the talker muted, and they can lift it with
/unmute or the scoreboard’s button (which asks OnPlayerVoiceMute); this call does not ask it.
It lasts while both are in the game: a mode that keeps mutes across visits saves them (OnPlayerVoiceMute,
GetPlayerVoiceMutes) and sets them again when the player joins.
Syntax
Section titled “Syntax”SetPlayerVoiceMutedFor(listener, talker [, muted])| Parameter | Type | |
|---|---|---|
listener |
number | the player who stops hearing |
talker |
number | the player they stop hearing |
muted |
boolean | true (the default) mutes, false lifts it (optional) |
Returns
Section titled “Returns”boolean: false for an unknown player or the same player twice
Example
Section titled “Example”-- the mode's own /block <id>, with the ids its scoreboard showsfunction OnPlayerCommandText(pid, cmd, args) if cmd == "block" or cmd == "unblock" then local target, why = GetPlayerId(args) if not target then SendClientMessage(pid, COLOR_WHITE, why or ("/" .. cmd .. " <id>")) elseif SetPlayerVoiceMutedFor(pid, target, cmd == "block") then SendClientMessage(pid, COLOR_WHITE, (cmd == "block" and "You no longer hear #" or "You hear #") .. target) end return true endendSee also
Section titled “See also”IsPlayerVoiceMutedFor · GetPlayerVoiceMutes · OnPlayerVoiceMute · SetPlayerVoiceMuted · the Voice chat group of the index
