GetPlayerLifeState
Jump to navigation
Jump to search
getPlayerLifeState
Returns the authoritative alive, downed, or dead state of a player.
Syntax
table|false getPlayerLifeState(int playerId)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
playerId |
int |
yes | The connected player identifier. |
Returns
Returns a table containing state, revision, serverTime, reviveAt, health, reviveHealth, sourcePlayer, movementLocked and autoRevive; returns false for an invalid player.
Examples
Inspect a player's life state:
local life = getPlayerLifeState(playerId)
if life and life.state == "downed" then
outputChatBox("This player needs help.", playerId)
end
Notes
- Available only in server-side resource scripts.
- Possible state strings are
alive,downed, anddead. - A
reviveAtvalue of 0 means there is no automatic revive deadline.