OnPlayerVoiceLevelChange
A player pressed the voice level key and asks for the next level.
level is the level they ask for, previous the one they speak at (both numbered from 1 in the SetVoiceLevels
list). Return false to refuse: they stay where they are and nothing shows on their screen - tell them why if you want
to. Nothing, nil or true lets the switch through. A player can switch at most five times a second; SetPlayerVoiceLevel
does not come here.
Syntax
Section titled “Syntax”function OnPlayerVoiceLevelChange(pid, level, previous) -- ...end| Parameter | Type | |
|---|---|---|
pid |
number | the player |
level |
number | the level asked for, from 1 |
previous |
number | the level they speak at now, from 1 |
Returns
Section titled “Returns”false refuses the switch
Example
Section titled “Example”-- nobody shouts inside the chapelfunction OnPlayerVoiceLevelChange(pid, level, previous) if GetVoiceLevels()[level].name == "Shout" and IsPlayerInZone(pid, chapel) then ShowInfoText(pid, "Not in the chapel.", 2500) return false endendSee also
Section titled “See also”SetVoiceLevels · SetPlayerVoiceLevel · the Voice chat group of the index
