12.09.2012, 11:52
Create a timer that saves the player's statistics every 30 seconds:
Then they will lose max. 30 seconds of their statistics, that's also a great feature in case your server crashes.
Before you make a restart, create a command which calls SaveAll(); again.
pawn Код:
public OnFilterScriptInit() //Or OnGameModeInit
{
SetTimer("SaveAll", 30000, 1);
return 1;
}
pawn Код:
forward SaveAll();
public SaveAll()
{
for(new i=0; i<MAX_PLAYERS; i++) if(IsPlayerConnected(i) && !IsPlayerNPC(i)) SavePlayerStats(i);
return 1;
}
Before you make a restart, create a command which calls SaveAll(); again.

