ID:1330454
 
(See the best response by FIREking.)
Code:
mob/proc/Save()
var/savefile/F = new("players/[src.ckey].sav")
F["name"] << usr.name
F["X"] << usr.x
F["Y"] << usr.y
F["Z"] << usr.z
//F["Mob"] << usr.client.mob

mob/proc/Load()
var/savefile/F = new("players/[src.ckey].sav")
var/X
var/Y
var/Z
//var/mob/newmob = new()
F["name"] >> usr.name
F["X"] >> X
F["Y"] >> Y
F["Z"] >> Z
//F["Mob"] >> newmob
usr.loc = locate(X,Y,Z)
usr.client = src.client


Problem description: Okay i have been trying to figure this out for about an hour. I want my code to detect if the user has a save file then if it does let it log in. Here is my Log in code actually my turf log in code.
            switch(input(usr, "What would you like to do", "New Or Load") in list("New", "Load"))
if("New")
usr.loc = locate(1,1,1)
usr.Powerlevel = rand(1,1500)
usr.can_move = 1
usr << 'calltoadventure.midi'
if("Load")
var/savefile/F = new("[usr.ckey]")
usr.Load(F)

So you want the save to be automatically loaded if it exists?

mob/Login()
. = ..()
if(Load())
// do whatever stuff you wanted to do

mob/proc/Load()
var load = 0
// check if save exists
// if it does, load = 1
// do load stuff
if(load) return 1
return 0
No i want it to check if the savefile exist.
Best response
if(fexists(filename))
I haven't tested it but i'm pretty sure it works since I've heard that you're a good programmer.
In response to D4RK3Z3R0
FIREking said it.

For an introduction to savefiles, I read Falacy's tutorial.