forked from Oskar1121/Ravendawn
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathQ1.lua
26 lines (24 loc) · 766 Bytes
/
Q1.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
-- Q1 - Fix or improve the implementation of the below methods
local function releaseStorage(player)
if player:getStorageValue(1000) == 1 then
player:setStorageValue(1000, -1)
end
end
function onLogout(player, delay)
if delay and delay > 0 then
-- Store player's id
local playerId = player:getId()
addEvent(function()
-- Get the Player from the stored player's id
local player = Player(playerId)
if player then
-- If the player exists, release the storage
releaseStorage(player)
end
end, delay)
else
-- Release the storage with no delay
releaseStorage(player)
end
return true
end