ID:139587
 
Code:
//Testing Mob Login
mob/Tester

Login()
//Default Behavior
..()

//Load the user's player file
client.Load()

//Build the user's icon and overlays
src.Build_Icons()
src.Build_Overlays()

//Check if the user doesn't have medal, if so give medal
if(world.SetMedal("Tester Medal", src))
src << "You've earned the \"Tester Medal\"!"



//Overriden client Del() Proc
client/Del()
//Take away "Tester Medal" before deletion
world.ClearMedal("Tester Medal", src)

//Save the user's player file
Save()

//Default Behavior
..()



//List of Icons for Characters
var/list/Char_Icons = list("Tester" = 'Tester Mob.dmi')

mob
//Default Mob Appearance
var/char_icon = "Tester"
var/hairSty = "bald"
var/hairCol = "#000000"

//Build the user's Icon
proc/Build_Icons()
var/icon/base = new(Char_Icons[char_icon]) //New icon/base var used to hold char_icon
icon = base //The icon/base var is used as the user's Icon

proc/Build_Overlays()
overlays.Cut() //Delete the user's overlays list
var/obj/olay = new //Var used later on to copy equipped objs' info
for(var/obj/O in equipment) //List all the objs in the user's equipment list
if(O.has_overlay) //Check if they are overlayable
olay.icon = O.icon //Copy the obj's icon to olay icon
olay.icon_state = "equipped" //Copy the obj's state to olay state
olay.layer = (O.equipment_layer || MOB_LAYER+1) //Set olay's layer to the obj equipment layer or Mob+1
overlays += olay //Add the copied version of obj(olay) to user overlays



//Read and Write built-in procs overridden
Read(savefile/F)
//Default Behavior
..()

//Build user icon and overlays
Build_Icons()
Build_Overlays()

//Relocate the user to his last saved position
var/turf/T = locate(F["x"], F["y"], F["z"])
if(T)
loc = T

Write(savefile/F)
//Default Behavior
..()

//Taking out mob icon/underlays/overlays from the savefile
F["x"] << x
F["y"] << y
F["z"] << z
F["icon"] << null
F["underlays"] << null
F["overlays"] << null

client
proc/Load()
var/firstletter=copytext(ckey, 1, 2) //Copy the first letter of the user's key
if(fexists("Saves/[firstletter]/[ckey].sav")) //Check if the user has a savefile
var/savefile/F = new("Saves/[firstletter]/[ckey].sav") //Navigate to the file
F["mob"] >> mob //Load the file


proc/Save()
var/firstletter=copytext(ckey, 1, 2) //Copy the first letter of the user's key
var/savefile/F = new("Saves/[firstletter]/[ckey].sav") //Navigate or Create the file
F["mob"] << mob


Problem description:
When I login it doesn't load back where I was last standing when I logged out.
    Read(savefile/F)
//Default Behavior
..()

//Build user icon and overlays
Build_Icons()
Build_Overlays()

//Relocate the user to his last saved position
var/turf/T = locate(F["x"], F["y"], F["z"])
if(T)
loc = T

Don't do this turf locating stuff here. Just have it load the saved x,y,z variables to the player.
If they are at an invalid location such as something outside of the world map's maxx, maxy, or maxz then their location is set to null.
You can create a check after this that can determine if they are at a null location, and move them accordingly, such as to locate(1,1,1)
Try this:
        var/last_x
var/last_y
var/last_z
F["x"]>>last_x
F["y"]>>last_y
F["z"]>>last_z
loc=locate(last_x,last_y,last_z)

In response to Gunbuddy13 (#1)
Thanks. Now if only I could get it to save.
In response to NaotaAmarao (#2)
Is it something that's really obvious?