OnPlayerRangedState

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 22:32, 14 August 2026 by QCherry (talk | contribs) (Update Lua event reference)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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.