ID:263756
 
Code:
        proc
saveplayer()
var/savefile/s=new/savefile("usrs/[src.ckey]")
s[src.name]<<src
s["[src.name]/locx"]<<x
s["[src.name]/locy"]<<y
s["[src.name]/locz"]<<z

Logout()
curparty.removeMember(src)
coolpassed=1
saveplayer()


Problem description:
This code is all located in /mob/player but when I close the game, it saves incorrect info to the savefile. The savefile dump looks like:

neoskye = object(".0")
.0
type = /mob
name = "Neo Skye"
gender = "male"
key = "Neo Skye"


I'm kind of guessing that my mob is being deleted before I get to the saving, but I'm not really sure.

Also, if I call saveplayer() from a verb, it saves just fine.

Any help is greatly appreciated :)
I had similar problem, I would do this:
        Logout()
curparty.removeMember(src)
coolpassed=1
saveplayer()
sleep(10)//sleep for 1 second after the saveplayer() is processed
del(src)//delete the source
In response to Kakashi24142
Question, does that work even if the person loggin out had clicked the X at the top right of the screen? i mean would it still be considered as logging out?
In response to VolksBlade
yea it does, I use the same code as I gave you and it works fine. Logout() is called AFTER the client has left. The mob stays in the world until it's manually deleted by Logout().
In response to Kakashi24142
thanks for the little lesson ^_^
In response to VolksBlade
no problem