Skip to content

OnPlayerVoiceMute

A player asks to stop hearing another player, or to hear them again.

The server’s /mute or /unmute (with a name or a player id) or the scoreboard’s mute button. It is for pid alone: everyone else still hears target. Return false to refuse - nothing changes (the scoreboard’s mark goes back) - and tell them why if you want to; nothing, nil or true lets it through. Save the change here to keep it across visits (GetPlayerVoiceMutes, then SetPlayerVoiceMutedFor at the next join). A mode that answers /mute itself in OnPlayerCommandText never comes here for it, and SetPlayerVoiceMutedFor does not either.

function OnPlayerVoiceMute(pid, target, muted)
-- ...
end
Parameter Type
pid number the player who asks
target number the player they want to stop hearing (or hear again)
muted boolean true = stop hearing them, false = hear them again

false refuses it

-- the herald may not be muted, and every mute is kept in the database
function OnPlayerVoiceMute(pid, target, muted)
if target == herald and muted then
SendClientMessage(pid, COLOR_WHITE, "The herald speaks for the king - you must hear him.")
return false
end
SaveMute(pid, target, muted) -- the mode's own function
end

SetPlayerVoiceMutedFor · GetPlayerVoiceMutes · IsPlayerVoiceMutedFor · the Voice chat group of the index