09.06.2012, 19:16
Like the title says, i want server to save player position when he leaves the server, like when i leave the server and come back then i spawn there, where i left the server. Any ideas?
new Float:X, Float:Y, Float:Z
GetPlayerPos(playerid, X, Y, Z);
On the player enum.
LastX,
LaxtY,
LastZ,
LastInt,
LastVw,
On ym registering system.
dini_FloatSet(file, "LastX", -2112.3652);
dini_FloatSet(file, "LastY", -2488.1548);
dini_FloatSet(file, "LastZ", 30.6250);
dini_IntSet(file, "LastInt", 0);
dini_IntSet(file, "LastVw", 0);
This is after checking player file, under OnPlayerSpawn, as i take it directly from the file....
SetPlayerVirtualWorld(playerid, dini_Int(file, "LastVw"));
SetPlayerInterior(playerid, dini_Int(file, "LastInt"));
SetPlayerPos(playerid, dini_Int(file, "LastX"), dini_Int(file, "LastY"), dini_Int(file, "LastZ"));
And under OnPlayerDisconnect:
new Float:px, Float:py, Float:pz, lint, lvw;
GetPlayerPos(playerid, px, py, pz);
lint = GetPlayerInterior(playerid);
lvw = GetPlayerVirtualWorld(playerid);
dini_FloatSet(file, "LastX", Float:px);
dini_FloatSet(file, "LastY", Float:py);
dini_FloatSet(file, "LastZ", Float:pz);
dini_IntSet(file, "LastInt", lint);
dini_IntSet(file, "LastVw", lvw);