11.03.2011, 23:07
Well, i'm looking for a command that will make sure that before it restarts the server, it will save every single player's file.. Currently I have the following command:
But the problem with this is, it just spams a print with a blank name 500 times, and doesn't actually save the file.
pawn Code:
COMMAND:restart(playerid, params[])
{
new File[50];
for(new i = 0; i < MAX_PLAYERS; i++)
{
format(File, sizeof(File), PFiles, pName(i));
GetPlayerPos(i, PVar[i][pLastX], PVar[i][pLastY], PVar[i][pLastZ]);
djSetInt (File, "Kills", PVar[i][pKills]);
djSetInt (File, "Deaths", PVar[i][pDeaths]);
djSetInt (File, "Admin", PVar[i][pAdmin]);
djSetInt (File, "Level", PVar[i][pLevel]);
djSetFloat (File, "LastX", PVar[i][pLastX]);
djSetFloat (File, "LastY", PVar[i][pLastY]);
djSetFloat (File, "LastZ", PVar[i][pLastZ]);
printf("%s has been saved.", pName(i));
//What's the function to make the server restart itself? I don't remember. OnGameModeExit(?)
}
return 1;
}