Skip to content

OnPlayerSleep

A player lay down in a bed, or got up again.

"lie" comes as the character starts to lie down (the animation takes a few seconds), with the game’s wheel or without it. "up" comes when the sleep ended, whatever ended it: the wheel’s own end, EndPlayerSleep, the player’s forward key, or the player being moved or killed in bed. The answer is not read.

function OnPlayerSleep(pid, state)
-- ...
end
Parameter Type
pid number the player
state string "lie" - lying down in a bed, "up" - up again
local slept = {}
function OnPlayerSleep(pid, state)
if state == "lie" then
slept[pid] = os.time()
ShowPlayerWebFrame(pid, "sleep") -- the mode's own sleep page
else
slept[pid] = nil
HidePlayerWebFrame(pid, "sleep")
end
end

SetPlayerSleepWheel · EndPlayerSleep · IsPlayerSleeping · the Beds and sleep group of the index