mob
var
OldEye = null
mob
Login() if(src.InGame == 0)
src.invisibility = 1
src.loc = locate(2,2,2)
src.OldEye = src.client.eye
for(var/obj/Action/Camera/A in world)
src.client.perspective=EYE_PERSPECTIVE
src.client.eye=A
var/obj/O = new
O.screen_loc = "CENTER,CENTER+3"
O.name = "In"
O.layer = 201
O.maptext_x = -256
O.maptext_width = 512
O.maptext_height = 128
O.maptext = "<font size = 5><font face = Gigi><font color = #8B0000><center>D<font color = #B22222>anger <font color = #8B0000>Z<font color = #B22222>one"
var/obj/Hud/Login/NewGame/O2 = new
O2.screen_loc = "CENTER-3,CENTER"
O2.name = "In"
O2.layer = 201
O2.maptext_x = -256
O2.maptext_width = 512
O2.maptext_height = 128
O2.overlays += icon('Misc.dmi',"C")
O2.maptext = "<big><font face = Gigi><font color = #8B0000><center> New Game"
var/obj/Hud/Login/LoadGame/O3 = new
O3.screen_loc = "CENTER+3,CENTER"
O3.name = "In"
O3.layer = 201
O3.maptext_x = -256
O3.maptext_width = 512
O3.maptext_height = 128
O3.overlays += icon('Misc.dmi',"C")
O3.maptext = "<big><font face = Gigi><font color = #8B0000><center> Load Game"
src.client.screen.Add(O,O2,O3)
if(src.key == "OttavioVaz")
src.verbs += typesof(/mob/Admin/verb/)
src<<browse(MsgLogin,"window=MsgLogin;size=500x500")
world << "<H4><font color = #C7F464>(System) <font color = #FA6900>[src.key] entered on the game.<br>"
mob/var/tmp/InGame = 0
mob
proc
Save_Character() if(InGame == 1) // Check if player is in game
var/savefile/F=new("Player/[src.ckey].sav") // Create a new savefile
// Store the cords
F["X"] << src.x
F["Y"] << src.y
F["Z"] << src.z
Write(F) // Save all the vars
mob
proc
Load_Character() if(InGame == 0) // Check if player is in login screen
if(fexists("Player/[src.key].sav")) // Check if exist a savefile
var/savefile/F=new("Player/[src.ckey].sav") // Load the savefile
// Transfer the cords to the vars
var/X
var/Y
var/Z
F["X"] >> X
F["Y"] >> Y
F["Z"] >> Z
Read(F) // Load all the stored vars
src.loc = locate(X,Y,Z) // Use the vars to teleport the character to the logout location
Problem description:
The problems is in the Load_Character() proc, by some reason the game logout and login back to the initial screen every time i call the Load_Character() proc, i just want to load the savefiles and then normally go to the game but i am really bad using files... yep i am newbie, can someone help me ?
Sorry for my bad English