OnPlayerRangedState
onPlayerRangedState
Triggered when the authoritative bow or crossbow action state changes.
Availability
This event is available in server-side scripts.
Callback signature
onPlayerRangedState(playerId, actionId, shotId, weaponType, phase, result, rejectReason, ammoRemaining)
Parameters
| Name | Type | Description |
|---|---|---|
playerId |
int |
The ranged-weapon user. |
actionId |
int |
The replicated ranged action ID. |
shotId |
int |
The shot sequence ID. |
weaponType |
string |
Either bow or crossbow. |
phase |
int |
The protocol ranged phase value. |
result |
int |
The protocol result value. |
rejectReason |
int |
The protocol rejection reason, or zero. |
ammoRemaining |
int |
Authoritative ammunition remaining. |
Examples
Handle the event:
addEventHandler("onPlayerRangedState", root, function(playerId, actionId, shotId, weaponType, phase, result, rejectReason, ammoRemaining)
outputDebugString(weaponType .. " action=" .. actionId .. " phase=" .. phase)
end)
Notes
- Phase, result, and reject-reason values are protocol enums; handle unknown future values safely.