mob
proc
SaveMob()
fdel("savefile/[usr.ckey].sav") // deletes the old save file
var/savefile/F=new("savefile/[src.ckey].sav") // creates a new save file
src.Write(F) // writes your variables/lists onto it
F["lastx"] << src.x //saves your x coord
F["lasty"] << src.y //saves your y coord
F["lastz"] << src.z //saves your z coord
Load()
if(fexists("savefile/[usr.ckey].sav"))//if an existing save file exists in the folder located in the game folder
var/savefile/F=new("savefile/[src.ckey].sav") // it creates a new save file
src.Read(F) //it reads it
var/newX
var/newY
var/newZ
F["lastx"] >> newX//it takes the lastx variable in the save and puts it into the newx variable
F["lasty"] >> newY//same as above with a new variable
F["lastz"] >> newZ//same as above with a new variable
src.loc=locate(newX,newY,newZ)//makes the player located in those locations
else //if no save file was found
usr << "No Save File" //outputs message to the user
return//returns
Delete()
fdel("savefile/[usr.ckey].sav")//deletes the save file, plain and simple lol
usr << "DELETED"
//now many ppl have had troubles making auto saving in their game, ITS SO EASY!
client
Del()//when the client is deleted
..()
mob.SaveMob()//save the mob
del (mob)//delete the mob *NOTE* always make sure to delete the mob AFTER you saved it
world
mob = /mob/newplayer
view=5
mob/newplayer
var/mob/character
Login()
switch(alert("What you want to do?",,"Create Character","Load Character","Delete Character"))//Character Handle
if("Create Character")
var/charactername = input("Whats your name?",,src.key)
switch(alert("Whats your gender?","Gender Select","Male","Female"))
if("Male")
switch(alert("Whats your skin color?",,"White","Tan"))
if("White")
character = new /mob/player/Male/White
if("Tan")
character = new /mob/player/Male/Tan
else return
if("Female")
switch(alert("Whats your skin color?",,"White","Tan"))
if("White")
character = new /mob/player/Female/White
if("Tan")
character = new /mob/player/Female/Tan
else return
else return
loc = locate(/turf/start)//Moves to first turf
world<<"[usr] entered the game!"//Sens message to the world
character.name = charactername
src.client.mob = character
del(src)
else if("Load Character")
Load()
..()
else if("Delete Character")
Delete()
..()
else return
..()
mob/player
var
HP=100
EP=10
BP=0
damage
Stat()
if(src==usr) stat(src.contents)
stat("Health:",HP)
stat("Stamina:",EP)
stat("Belive:",BP)
statpanel("Inventory",contents)
mob/player/Male/White
icon='Male.dmi'
icon_state="WMale"
mob/player/Male/Tan
icon='Male.dmi'
icon_state="BMale"
mob/player/Female/White
icon='Female.dmi'
icon_state="WFemale"
mob/player/Female/Tan
icon='Female.dmi'
icon_state="BFemale"
Problem description:
I'm trying to make that when player logs in and customizes the character it gets lockaed at all same place for now.But somehow the location falls and the char gets located to 1,1,1.I'm pretty sure I'm missing something small but no idea where.Soo at new character they get lockated to wrong place.At loading back icon not displays but I'm working on that.Thanks for help anyway.