GetPlayerEnergy
How rested the player’s character is.
The character’s energy (the Rest) in the game’s own scale and the most it can hold, as the player’s game last reported
them - and, under [audit] mode = "enforce", never above the game’s own maximum of 100, since a value over it is put back.
The game runs it down as the character stays awake and up as they sleep. After a SetPlayerEnergy made before the
player’s game has reported, the value is the one set and the maximum is 0 until the first report - check max before
you divide by it.
Syntax
Section titled “Syntax”GetPlayerEnergy(pid)| Parameter | Type | |
|---|---|---|
pid |
number | the player |
Returns
Section titled “Returns”number | nil, number | nil - value, max - the energy and its maximum, which is 0 while only the mode’s own set is known; nil until the player’s game has reported or the mode has set it, or for a player not connected
Example
Section titled “Example”local rest, max = GetPlayerEnergy(pid)if rest and max > 0 and rest < max * 0.1 then SendClientMessage(pid, COLOR_YELLOW, "You can barely keep your eyes open.") endSee also
Section titled “See also”SetPlayerEnergy · GetPlayerNourishment · GetPlayerProgress · the Stats, skills, XP and perks group of the index
