OnPlayerVoiceStateChange

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search

onPlayerVoiceStateChange

Triggered after a player's authoritative voice-routing or capture policy changes.

Availability

This event is available in server-side scripts.

Callback signature

onPlayerVoiceStateChange(playerId, mode, rangePreset, flags, channelId, range, volume)

Parameters

Name Type Description
playerId int The affected connected player ID.
mode int Voice mode: 0 disabled, 1 proximity, 2 channel, or 3 global.
rangePreset int Range preset: 0 whisper, 1 normal, 2 shout, or 3 custom.
flags int Bitmask: enabled 1, speaking 2, server-muted 4, and push-to-talk 8.
channelId int The authoritative voice channel identifier.
range number The effective proximity range in metres.
volume number The authoritative volume multiplier from 0.0 through 2.0.

Examples

Handle the event:

addEventHandler("onPlayerVoiceStateChange", root, function(playerId, mode, rangePreset, flags, channelId, range, volume)
    outputDebugString("Voice state updated for player " .. playerId .. ", mode " .. mode)
end)

Notes

  • The state is reliable and replayed during late join.
  • Use the voice getter functions when string mode or preset names are more convenient than numeric protocol values.