12.03.2011, 00:01
Managed to fix it with a ConnectedPlayers & IsPlayerConnected check.
pawn Code:
COMMAND:restart(playerid, params[])
{
new File[50];
printf("Saving %d players...", ConnectedPlayers);
for(new i = 0; i < ConnectedPlayers; i++)
{
if(IsPlayerConnected(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]);
djSetInt (File, "Money", PVar[i][pMoney]);
djSetInt (File, "Skin", PVar[i][pSkin]);
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));
}
}
GameModeExit();
return 1;
}