OnPlayerLifeStateChange
Jump to navigation
Jump to search
onPlayerLifeStateChange
Triggered whenever the authoritative life state changes between alive, downed, and dead.
Availability
This event is available in server-side scripts.
Callback signature
onPlayerLifeStateChange(playerId, previousState, currentState, sourcePlayerId, reason, reviveAtServerTimeMs)
Parameters
| Name | Type | Description |
|---|---|---|
playerId |
int |
The affected player ID. |
previousState |
string |
The previous state: alive, downed, or dead. |
currentState |
string |
The new state: alive, downed, or dead. |
sourcePlayerId |
int |
The player responsible for the transition, if any. |
reason |
string |
The transition reason. |
reviveAtServerTimeMs |
int |
Scheduled server-time revival timestamp, or zero when not scheduled. |
Examples
Handle the event:
addEventHandler("onPlayerLifeStateChange", root, function(playerId, previousState, currentState, sourcePlayerId, reason, reviveAtServerTimeMs)
outputDebugString(getPlayerName(playerId) .. ": " .. previousState .. " -> " .. currentState)
end)