Skip to content

SetPlayerEnergy

Sets how rested the player’s character is.

value is 0 or more, clamped to the maximum once the server knows it (GetPlayerEnergy gives both) - and, under [audit] mode = "enforce", to the game’s own maximum of 100 whatever their game reported (observe leaves the mode’s own value as it is); the game runs it on from there. A set of the mode’s own voids the energy check’s stretch of judging for that value, so setting it never reads as a trainer. Called before the player is in the world, it is applied right after their spawn.

SetPlayerEnergy(pid, value)
Parameter Type
pid number the player
value number the energy, 0 or more

boolean - false for a value below 0 or not a number, or a player not connected

-- a night in the inn's bed
local _, max = GetPlayerEnergy(pid)
if max and max > 0 then SetPlayerEnergy(pid, max) end

GetPlayerEnergy · SetPlayerNourishment · the Stats, skills, XP and perks group of the index