ID:134352
 
Could we perhaps get a client/Logout proc that is called before the client is completely trashed, and calls client.Del(), or is this just one of those things that isn't possible? I'd just like to be able to Export a savefile just before the client leaves, and only before the client leaves.
Is mob/Logout() not sufficient for your purposes?
In response to Crispy
Crispy wrote:
Is mob/Logout() not sufficient for your purposes?

By the time <code>mob.Logout()</code> has been called, the client is long gone.
Override client/Del(), calling ..() after you have saved their file, and everything should be peachy.
In response to Jtgibson
For some reason, this just isn't working for me. Here's what I'm currently doing:

client
New()
..()
var/client_file = Export()
if(client_file) Read(new(client_file))
Del()
SessionTimer.Stop()
TotalTime += SessionTimer.Seconds()
AFKTime += SessionAFKTimer.Total()
if( !saved ) Save()
UserCount--
world.Status()
if( MyRoom )
MyRoom.Leave(src)
for( var/client/C )
C << "[C.Timestamp()][key] has logged out!"
return ..()
proc
Save()
// Write( new/savefile( "Users/[ckey].sav" ) )
var/savefile/F = new
Write( F )
Export(F)
saved = 1 // Set, just in case a reboot is initiated. Then we can save all the files before disconnecting everyone.


And it doesn't appear to be actually exporting the savefile.