ID:141625
 
Code:
mob/var
Exists=0

client
proc
Load()
var/savefile/load
load = new ("Player Saves/[mob.ckey].sav")
load["mob"] >> src.mob
load["x"] >> src.mob.x
load["y"] >> src.mob.y
load["z"] >> src.mob.z
Save()
if(!src)return
if(!src.mob)return
var/savefile/save
save = new ("Player Saves/[mob.ckey].sav")
save["mob"] << src.mob
save["x"] << src.mob.x
save["y"] << src.mob.y
save["z"] << src.mob.z

mob
Logout()
src.client.Save()
world<<"[src] has logged out"
del(src)
Login()
if(src.Exists==1)
src.client.Load()
else
src.verbs-=typesof(/mob/verb)
if(src.client.key == "Guest")
del(src.client)
src.loc = locate(16,16,2)
src<<"If you take the blue pill, you return to the matrix, and you forget everything of us<br>But if you take the red pill, i will show you, just how far, the rabbithole goes"
switch(input("What pill do you take?","The choice") in list("I take the blue pill","I take the red pill"))
if("I take the blue pill")
src<<"Then you return to the matrix..."
sleep(20)
del(src)
else
var/N = input("Please choose your name...","?")as text
if(!N)
src<<"You dont wanna play games? Mr Anderson?"
sleep(20)
del(src)
if(Check_For_Illigal(N,Special) == TRUE)
src<<"You cannot change the rules of the game, only bend them..."
sleep(20)
del(src)
src.name="[N]"
src<<browse(welcome,"window=Welcome;size=320x420;can_close=1;can_resize=1;can_minimize=1")
src.loc=locate(12,41,1)
src.icon='Shark1.dmi'
src.icon_state="0,1"
src.verbs+=typesof(/mob/verb)
src.Exists=1
src.client.Save()


Problem description:
Well the problem is semi obvious, the save just doesnt work. lol i set the var Exists=0 so that from the start it isnt real, then once you make a char it becomes 1 so that it just loads

Btw, if there is an error in the indentation around the line, you dont wanna play games? Mr Anderson?, ignore it, its jjust my copy and paste skills fail lol

Amongst other things, I think the issue has to do with your logic in using this "Exists" var... When they login, a brand new mob is created for them until you load their old one. Since you saved Exists=1 in the old save, which doesn't get loaded yet, it will always be 0. If you want to check for the existance of a save file, you should use fexists().
First of to start with you have
mob
Login()
if(src.Exists==1)//Switch this to: if(src.Exists)
src.client.Load()

Exist is always 0 you need to grab that var out of the client.savefile and then if it is 1 you load it.
Do this:
if(fexisits("Player Saves/[src.ckey].sav"))
src.client.Load()

In response to Yash 69
Yash 69 wrote:
First of to start with you have
> mob
> Login()
> if(src.Exists==1)//Switch this to: if(src.Exists)
> src.client.Load()
>
>

Exist is always 0 you need to grab that var out of the client.savefile and then if it is 1 you load it.
Do this:
> if(fexisits("Player Saves/[src.ckey].sav"))
> src.client.Load()
>


First off are you saying i should lose the whole Login if(src.Exists thing? and replace it with the fexists?

If so, then im getting an error saying fexists is undefined, but im pretty sure its a predefined proc

found the bug, if(fexisits lol...

still time to tets it out

In response to Rushnut
Okay, now this ones a bit more confusing...

take the previous (original) bit of code, remove the if(src.Exists==1) crap, replace it with
if(fexists("Player Saves/[src.ckey].sav"))
src.client.Load()
world<<"[src] has logged in"
src.icon='Shark1.dmi'
src.icon_state="0,1"
src.verbs+=typesof(/mob/verb)

and then tell me why whenever i try and join it says connection failed, and no its nothing to do with the guest boot, because i made it say hais if you are a guest then it boots, and i tryed logging in on a guest and it works perfectly, well, it says hais then boots.

so yea. if you understand what i say i think you should be able to fix it, i mean, understanding me is ahrd enough