• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Player Log out ~Player Save~

killing

Member
Joined
Feb 23, 2012
Messages
815
Reaction score
11
Location
BIH
Hello
I need a Script that well Save player when player Log-Out. (When one player Log-out,All players save and players houses.)
I do not want to i get any msg's on my server loger..
 
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
 
That aint that smart, why should you save ALL players if only one player logs out...?
That will cause unnecessary lag..
100 players online, 10 logout in 5 mins so the server will save 10 times in 5 mins lol...
 
lol
I have not think abouth that loly..
Thanks =)

- - - Updated - - -

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


Where do add That script??

- - - Updated - - -

and i dont want to all player save when one player log-out..
 
data/creaturescripts/scripts/logout.lua

doPlayerSave(cid) will only save the player which logs out..

after:
function onLogout(cid)
add:
doPlayerSave(cid)

no clue what else you got in there, thats why im not sayin replace all :p
 
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:
doPlayerSave(cid)

- - - 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)
 
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
 
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)


Okay i did not have time for my Request but now i do..
Cyko Where to Put that Script i do not have Logout.lua in creaturescripts And what to put in XML?
exhaust= 30 sec

- - - Updated - - -

And is it Going to make Lag on server?

Please look at this photo
https://i.imgur.com/9tg7VTw.png

- - - Updated - - -

I do not know where to put this Script

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
 
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

Flags. 13 = save players (1), map (4) & game state (8).
 
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


Where is exhaust?
and where i need to put Script?
 
I think that this is a really bad idea, stupid players will use this to lag you server, with or without exhaustion. To clone items your server need crash, so the better way will be fixing the crash problem. And if 10 players logout at the same time, i think that the server will save 10 times, one after one.
 
Back
Top