ID:142441
 
Code:
mob
proc
load()
if(!src)
return
if(src.joe)
return
if(fexists("players/[usr.key]"))
var/savefile/load
load = new ("players/[usr.key]")
load["mob"] >> usr
load["x"] >> usr.x
load["y"] >> usr.y
load["z"] >> usr.z
world<<"<font size=1><font color=yellow><B>Info:<font color = silver> [usr] has logged on the server."
usr.joe = 1
usr.invisibility = 0
//skip half the code
usr.OOC = 1
usr.cansave=1
usr.frozen = 0
usr.defence = usr.mdefence
usr.attack = usr.mattack
del(src)
usr.AutoSave()
if(usr.invai)
usr.invai = 0
usr.loc = locate(73,29,5)
if(usr.race == "UNID")
usr.rundelay = 0
return

obj
save
name = "Save"
icon = 'bars.dmi'
screen_loc = "12,1"
icon_state = "save"
layer = MOB_LAYER+101
Click()
var/savefile/save
save = new ("players/[usr.key]")
save["mob"] << usr
save["x"] << usr.x
save["y"] << usr.y
save["z"] << usr.z
usr << "<font color=red><b>Your game has been saved!"


Problem description:

Ok heres the thing no matter what i do i cant save their attack/defence or mattack/defence i tried to save[usr.attack] << usr.attack but i just get a messed up prob when i log in with runtime error blah blah any suggestions how to save their stats then load them again later? or do you need more code? though i doubt the other code will come in handy considering it has nothing pertaining to stats in it.

You need to add .sav to the end of the savefile names, similar to how you add .dmi to the end of icon names.
In response to Jeff8500
No, it's unnecessary, only customary. You can use any extension you want, or none, with no problems.
On the other hand, while on the subject of filenames, they cannot contain most special symbols, so you should make sure to remove those when creating files with variable names. You can use the cKey() proc to that on any string, or in the case of mob or client keys, use the precomputed ckey var.
In response to Kaioken
Thx its fixed now O_O