09.10.2010, 08:50
I wish to save player when GM closes. However GetPlayerPos returns just 0's under OnGameModeExit. What to do?
if(YOUR_POS_VARIABLE != 0) SavePos // or something
I had exactly the same problem. When i restarted the server, the position returns 0, so the player will spawn somewhere on 0, 0 ,0. My solution was creating a check at the savesection, to make sure the position dont save it is was 0:
Код:
if(YOUR_POS_VARIABLE != 0) SavePos // or something I use a timer in my restart command to, to make sure the server has time to save the value's. |
dcmd_rexit(playerid, params[]) { SetTimer("Exittimer",2000,0); SendClientMessageToAll(YOURCOLOR,"SERVER: Exit cmd activated, server shutdown!"); SaveAllStats // Add here your statssaving function return 1; } public Exittimer() { SendRconCommand("exit"); return 1; }
enum Pos {
Float:XPos,
Float:YPos,
Float:ZPos,
};
new Gi[MAX_PLAYERS][Pos];
GetPlayerPos(playerid,Gi[playerid][XPos],Gi[playerid][YPos],Gi[playerid][ZPos]);
SetPlayerPos(playerid,Gi[playerid][XPos],Gi[playerid][YPos],Gi[playerid][ZPos]);