GetPlayerLifeState: Difference between revisions

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search
Automatyczna aktualizacja dokumentacji funkcji
 
Complete Lua function catalog
 
Line 32: Line 32:
* A <code>reviveAt</code> value of 0 means there is no automatic revive deadline.
* A <code>reviveAt</code> value of 0 means there is no automatic revive deadline.


[[Category:Lua Functions]]
[[Category:Server Functions]]
[[Category:Server Functions]]
[[Category:Player Functions]]
[[Category:Player Functions]]
[[Category:Life State Functions]]
[[Category:Life State Functions]]

Latest revision as of 09:53, 15 August 2026

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, and dead.
  • A reviveAt value of 0 means there is no automatic revive deadline.