Skip to content

EndPlayerSleep

Gets a player lying in a bed up, with the game’s own get-up animation.

Ends any bed’s sleep - one without the wheel, or one with the wheel still up (it closes). OnPlayerSleep says "up" once they are standing.

EndPlayerSleep(pid)
Parameter Type
pid number the player

true, or false and why: "not sleeping", "not in the world", "their game cannot", "not connected"

-- Rest back in real time: one point a second, up at full Rest
function OnTick(dt)
for pid in pairs(slept) do
local rest, max = GetPlayerEnergy(pid)
if rest and rest < max then
SetPlayerEnergy(pid, math.min(max, rest + dt))
elseif rest then
EndPlayerSleep(pid)
end
end
end

SetPlayerSleepWheel · OnPlayerSleep · the Beds and sleep group of the index