OnPlayerLifeStateChange

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 22:31, 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

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)