function onLogout(cid)
doPlayerSave(cid)
end
Well, you can save player on logout but not house, that require source edit. If you dont use global save ofc.
Lua:function onLogout(cid) doPlayerSave(cid) end
doPlayerSave(cid)
function onLogout(cid)
if getPlayerStorageValue(cid,3333) >= os.time() then
doPlayerSendCancel(cid, "You have to wait "..os.time() - getPlayerStorageValue(cid, 3333)..".")
else
doPlayerSave(cid)
end
return true
end
local time = 10 -- 10 seconds cooldown until they can logout
setPlayerStorageValue(cid, 3333, os.time()+time)
This means it will save they player which logged out, not it will save all players when one player logout. Only the one which logged out:
- - - Updated - - -
We can also put exhaust on logout:
Lua:function onLogout(cid) if getPlayerStorageValue(cid,3333) >= os.time() then doPlayerSendCancel(cid, "You have to wait "..os.time() - getPlayerStorageValue(cid, 3333)..".") else doPlayerSave(cid) end return true end
This at login.lua under function onLogin(cid):
Lua:local time = 10 -- 10 seconds cooldown until they can logout setPlayerStorageValue(cid, 3333, os.time()+time)
function onLogout(cid)
if getPlayerStorageValue(cid,3333) >= os.time() then
doPlayerSendCancel(cid, "You have to wait "..os.time() - getPlayerStorageValue(cid, 3333)..".")
else
doPlayerSave(cid)
end
return true
end
he probably wants to prevent duplicating items, use other systems instead(such as anti dupe or mock's cloning protection which saves both players after they trade)
if you want to save entire server use "doSaveServer(13)" instead. Not sure what 13 means, it's in /save command file
function onLogout(cid)
if getPlayerStorageValue(cid,3333) >= os.time() then
doPlayerSendCancel(cid, "You have to wait "..os.time() - getPlayerStorageValue(cid, 3333)..".")
else
doPlayerSave(cid)
end
return true
end
Well, you need sources then to compile it to gui version :/