ID:1301815
 
(See the best response by Jittai.)
Code:
mob
proc
saveproc()
if(src.cansave)
if(src.contents.len>=1)
var/keys=src.key
var/savefile/save
save = new("playerswwa/[keys]/[src.name]")
save["mob"] << src
save["x"] << src.x
save["y"] << src.y
save["z"] << src.z

mob
proc
load()
if(!src)
return
var/keys=src.key
var/list/saveFiles=src.get_char_list()
if(!src.count_chars())
return
var/choice=input("Welcome to (game name)! Who do you want to load?\n\n\
\n\nSavefiles Used:
[src.count_chars()]/3","Login")as null|anything in saveFiles

if(fexists("playerswwa/[keys]/[choice]"))
var/savefile/load
load = new ("playerswwa/[keys]/[choice]")
load["mob"] >> usr
load["x"] >> usr.x
load["y"] >> usr.y
load["z"] >> usr.z
//rest of load proc

client
Del()
if(src.banned)
return..()
if(!src.mob)
return..()
else
if(!src.banned)
if(!src.mob.toofull)
if(src.key!="Critical172")
world << output("<b><font color = white>Info:<font color = blue> [src.mob]([src]) has logged off!","output")
maxplayers-=1
if(src.mob.toofull)
src.mob<<output("<b><font color = white>Info:<font color = blue> Server Full!","output")
for(var/obj/M in world)
if(M.owner == src.mob)
del M
for(var/mob/M in world)
if(M.owner == src.mob)
del M
//lots of stuff right here to take the player out of various events
src.mob.saveproc()
del(mob)
return..()
client
New()
if(src.key == "")
del src
..()
if(src.key in bannedkeys)
del src
if(src.address in bannedips)
del src
if(maxplayers>80)
if(src.key != "Critical172"&&src.key != "Chev45"&&src.key != "Young money 214"&&src.key != "Zagros5000")
src.mob.toofull=1
del src
return
maxplayers+=1
//the rest of the hud being loaded


Problem description:

Somehow clones are randomly being made when people relog. It doesn't happen a lot, but when they log out then log back in there will be a copy of their character as if it didn't delete after the player logged out and will result in a rollback after reboots. I'm not sure if it's something with the saveproc or logging out. How does that even happen and how do you fix that?
Is there no way to solve this?
This may or may not be the solution, but in your load() function, you go from using src to using usr.
Best response
You should check out what you're saving and see if you're saving direct references to other people's clients. Like in a target, friends or clan system.

Also, "for(var/mob/M in world) if(M.owner == src.mob) del M", perhaps you could form a list belonging to client's regarding any mobs which they may be an owner of, and just delete mobs in that last instead of for()'ing every mob.

Good luck.
I figured out why the clones come. I have an owner var. If the user's owner var is another player, after the user relogs the other player gets cloned and put at the loginscreen. The only way for them to leave the loginscreen is to use the stuck verb. How else can I use the owner var without having this issue?
Use tmp/ or if you HAVE to save it, use their ckey instead.

Also, the stuck verb doesn't fix the issue- the issue is you're saving people inside of other people's saves. When one person is loaded it loads the other person too.