loging proc
Login()
..()
world<<"INFO: [key] has joined the server"
//simple alert proc asking if they want to load or creat a player. This calls the load proc or the create proc
Logout()
world<<"INFO: [src]([key]) has left the server."
del(src)
//I've also tried this with ..() at the end but for some reason that causes the players mob to stay in the game for some reason.
//loading...
if(fexists("Players/[src.key].sav"))
var/savefile/F = new("Players/[src.key].sav")
Read(F)
loc=locate(xco,yco,zco)
src.cansave=1
src.save()
world<<"INFO: [src] ([key]) has loaded their character"
//saving...
if(src.cansave)
var/savefile/F = new("Players/[src.key].sav")
src.xco = src.x
src.yco = src.y
src.zco = src.z
Write(F)
Problem description:
My players' savefile are continuously becoming corrupt. When they load their character it says (forAosuke)
INFO: Aosuke () has left the server.
INFO: Aosuke has joined the server.
INFO: Aosuke (NASHIE) has loaded their character.
every time this happens it seems to bog down the server and then the client that is loading their character gets disconnected from the game.
Should I be using .=..() instead of ..() and if so then which portion should I be using it?
EDIT: I may have fixed it, I wont know until tomorrow so please, any suggestions are still welcome
If you want something to occur ONLY when a player connects to your server, you either need to put it in client/New(), or put it in the Login() procedure for a mob subtype which is ONLY used for players newly connecting to the server.
Furthermore, you should not be calling Read() or Write() directly, as it results in mangled savefiles and unpredictable behavior, as you now have. You should instead be using the << and >> savefile operators, like so: