Skip to content

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.

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)

boolean: false for an unknown player or the same player twice

-- the mode's own /block <id>, with the ids its scoreboard shows
function 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
end
end

IsPlayerVoiceMutedFor · GetPlayerVoiceMutes · OnPlayerVoiceMute · SetPlayerVoiceMuted · the Voice chat group of the index