Server saving in Developer Help
|
|
I have been looking around to find a nice server save system for my game and i found one: server2server i think its called.
My question is can a system like this incoporate slot saving.
world/Topic(T, Addr, Master, Key) if(T == "playerfile") var/X = world.Import() if(X) var/savefile/F = new(X) if(F && istype(F)) var/name = F["ckey"] if(!name) return -2 for(var/mob/M in world) if(M.ckey == name) F["MOB"] >> M return 1 return -3 else return -1 return ..()
client proc Save() if(usr.savefile1) var/savefile/F = new("players/[usr.ckey]/[usr.ckey](1).sav") usr.savefile1=1 usr.V += usr.verbs usr.Write(F) switch(world.Export("byond://000.000.000.000:1234?playerupload",F)) if(1) usr << "The remote server has your file." if(-1) usr << "The remote server is refusing connections. Your character could not be saved at this time." if(-2) usr << "The remote server reports that it cannot read the savefile. Your character could not be saved at this time." if(-3) usr << "The remote server reports that it has received no file or not a valid savefile. Your character could not be saved at this time." else usr << "The remote server is unavailable. Your character could not be saved at this time." else if(usr.savefile2) var/savefile/F = new("players/[usr.ckey]/[usr.ckey](2).sav") usr.savefile2=1 usr.V += usr.verbs usr.Write(F) switch(world.Export("byond://000.000.000.000:1234?playerupload",F)) if(1) usr << "The remote server has your file." if(-1) usr << "The remote server is refusing connections. Your character could not be saved at this time." if(-2) usr << "The remote server reports that it cannot read the savefile. Your character could not be saved at this time." if(-3) usr << "The remote server reports that it has received no file or not a valid savefile. Your character could not be saved at this time." else usr << "The remote server is unavailable. Your character could not be saved at this time." else if(usr.savefile3) var/savefile/F = new("players/[usr.ckey]/[usr.ckey](3).sav") usr.savefile3=1 usr.V += usr.verbs usr.Write(F) switch(world.Export("byond://000.000.000.000:1234?playerupload",F)) if(1) usr << "The remote server has your file." if(-1) usr << "The remote server is refusing connections. Your character could not be saved at this time." if(-2) usr << "The remote server reports that it cannot read the savefile. Your character could not be saved at this time." if(-3) usr << "The remote server reports that it has received no file or not a valid savefile. Your character could not be saved at this time." else usr << "The remote server is unavailable. Your character could not be saved at this time."
Load() if(src.mob) switch(alert(usr, "Welcome to [world.name]", "Slot Loading","Slot 1","Slot 2","Slot 3")) if("Slot 1") switch(world.Export("byond://000.000.000.000:1234?playerdownload",F)) if(1) usr << "The remote server has your file." if(fexists("players/[usr.ckey]/[usr.ckey](1).sav")) var/savefile/F = new("players/[usr.ckey]/[usr.ckey](1).sav") usr.Read(F) for(var/stuff in usr.V) usr.verbs += stuff sleep(1) usr.savefile1=1 world<<"<B>World: <font color=yellow>[src] has logged in!!!!!" usr.Auto_Save() usr.client.show_verb_panel = 1 else alert("No savefile found in this slot!") return if(-1) usr << "The remote server is refusing connections. Your character could not be loaded at this time." if(-2) usr << "The remote server reports that it cannot read the savefile. Your character could not be loaded at this time." if(-3) usr << "The remote server reports that it has received no file or not a valid savefile. Your character could not be loaded at this time." else usr << "The remote server is unavailable. Your character could not be loaded at this time."
|
THE SERVER CODE IS WHAT IM STUCK WITH HOW DO I PROCEDE ON MAKING IT CAPABLE TO HANDLE SLOTS.
world/Topic(T, Addr, Master, Key) if(T == "playerupload") var/X = world.Import() if(X) var/savefile/F = new(X) if(F && istype(F)) var/name = F["ckey"] if(!name) return -2 fcopy(X,"savefiles/[name].sav") return 1 return -3 else return -1 if(T == "playerdownload") var/X = world.Import() if(X) var/savefile/F = new(X) if(F && istype(F)) var/name = F["ckey"] var/Port = F["Port"] if(!name) return -2 var/savefile/S = new("savefiles/[name].sav") world.Export("byond://[Addr]:[Port]?playerfile",S) return 1 return -3 else return -1 return ..()
var/password = "password" var/tries = 3 client verb
DeleteSave() var/Pass=input("What is the password?","Password") as text if(!tries) usr << "3 times wrong, You can not do the file delete." return if(Pass == password) var/delete=input("Who'se savefile to delete?","Delete") as text if(fexists("savefiles/[delete].sav")) fdel("savefiles/[delete].sav") usr << "Deleted [delete].sav" world.log << "[usr] deleted [delete].sav" else usr << "Not found." else tries -- usr << "Wrong pass. You have: [tries] tries left"
P_Whipe() set name = "P-Whipe" var/Pass=input("What is the password?","Password") as text if(!tries) usr << "3 times wrong, You can not do the file delete." return if(Pass == password) if(fexists("savefiles/")) fdel("savefiles/") usr << "P-Whiped" world.log << "[usr] Did a P-Whipe" else usr << "Not found." else tries -- usr << "Wrong pass. You have: [tries] tries left"
|
|