ID:1846292
 
(See the best response by Lummox JR.)
Code:
mob/proc
Save()
if(!key) return
if(!saving)
saving=1
var/savefile/S=new("Save/[key].sav")
S["x"]<<x
S["y"]<<y
S["z"]<<z
Write(S)
saving=0
Load()
if(!key) return
if(fexists("Save/[key].sav"))
var/savefile/S=new("Save/[key].sav")
Read(S)
S["x"]>>x
S["y"]>>y
S["z"]>>z
Savable=1
spawn Stats()
Auto_Save_Char()
else
alert("You do not have any characters on this server.")
Choose_Login()

mob
proc
Choose_Login()
if(!temporary)
var/Choice=alert(src,"Make your choice","","New","Load")
switch(Choice)
if("New")
New_Character()
CheckRank()
move=1
attackable=1
attacking=0
displaykey=key
logged=worldtime
timemult=1
DeclineAge=round(DeclineAge,0.1)
orefire=refire
statstab=1
FirstYearPower=round(RecordPL)
BirthYear=Year
LastYear=BirthYear
OPLMod=PLMod
spawn CheckIncarnate()
BirthYear=Year
if(Offense<10) Offense=10
if(Defense<10) Defense=10

Savable=1
spawn Stats()
// client.prespective=EYE_PERSPECTIVE
client.perspective=EDGE_PERSPECTIVE
client.eye=src
client.show_map=1
Goto_Spawn()
//UpdateBars()
Packs()
spawn Stats()
Auto_Save()
Auto_Save_Char()
client.show_verb_panel=1
if("Load")
Load()
client.show_verb_panel=1
for(var/obj/build/A in contents) del(A)
spawn if(buildon) AddBuilds()
Rank_Verb_Assign()
overlays-='Blast Charging.dmi'
var/haszenni
for(var/obj/Zenni/Z in contents) haszenni=1
if(!haszenni) contents+=new/obj/Zenni
invisibility=0
spawn if(Oozaru)
Oozaru_Revert()
if(KO) KO()
for(var/obj/KiAttacks/A in contents)
A.streaming=0
A.charging=0
A.chargelvl=0
// client.prespective=EYE_PERSPECTIVE
client.perspective=EDGE_PERSPECTIVE
client.eye=src
AdminCheck()
AgeCheck()
Packs()
Save()
//UpdateBars()
Gaining_Average()
CheckStatSubscription()
client.show_map=1
Redoing_Stats=0
client.show_verb_panel=1
var/screenx=16
var/screeny=16
usr.client.view="[screenx]x[screeny]"


Problem description:
These are snippets of my code, for some reason. When someone saves or just plain out reconnects, they have a chance of getting into a black screen, where they can't see themselves or where they can't even see other icons.

I dont know what it is or how, I can fix it.
Best response
You can't load x, y, and z individually like that. If all of them are 0, when you load x you'll effectively be trying to change loc to locate(12,0,0) or what have you. Since that's still null, x stays 0. Then you load y and maybe it tries locate(0,3,0), and then the process repeats with z.

What you need to do is create three local vars, and load the x,y,z coords into those. Then set loc to the locate() for all three vars at once.

var/savedx, savedy, savedz
S["x"] >> savedx
S["y"] >> savedy
S["z"] >> savedz
loc = locate(savedx, savedy, savedz)

I should add that you have usr in a proc, which is not a good idea.
In response to Lummox JR
Thanks do you think that's the only problem ?