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

TFS 0.X Storage on EXIT.

Otlandserv

Member
Joined
May 22, 2023
Messages
58
Reaction score
5
Hello.
I have problem, becouse i have code where add storage on login and change storage when logout.
But when click "EXIT" my character is still login and my storage not change to default.

How can i deal with it?
 
Hello.
I have problem, becouse i have code where add storage on login and change storage when logout.
But when click "EXIT" my character is still login and my storage not change to default.

How can i deal with it?
you need to understand that neither onLogin or logout will work till the player disappears from the game map anyway you can use onThink from creaturescripts to check if player:getIp == 0 then player:setStorageValue(key, value) player:remove() end
 
you need to understand that neither onLogin or logout will work till the player disappears from the game map anyway you can use onThink from creaturescripts to check if player:getIp == 0 then player:setStorageValue(key, value) player:remove() end
Yes, you right but... If player click exit on PVP with etc. skull or when PK battle with this player this is big problem.
 
Hello.
I have problem, becouse i have code where add storage on login and change storage when logout.
But when click "EXIT" my character is still login and my storage not change to default.

How can i deal with it?
i think you can added idle system for afking, so it can kick the player if he got afking for a specific time.
 
Yes, you right but... If player click exit on PVP with etc. skull or when PK battle with this player this is big problem.
then don't kick the player and wait for him to disconnect automatically and when he do onLogout function will happen, if he xlogged on the online char for example in trainers then the onLogin won't happen

If that storage is updated bas on the client connection then i suggest upgrading creaturescripts to include onConnect and onDisconnect which i don't think is needed as logout won't happen on exit and login won't happen on xlogged.
 
On newer protocols there's a communication with client so you check such cases by checking player lastPong time against current OTSYS_TIME to check whether diff is greater than ping interval (+ some additional seconds as a grace period) or not. It's used to prevent deaths by disconnect (client crash)
 
Last edited:
Back
Top