08.06.2011, 17:53
Hello sim_sima,
I suggest you to take a timer which saves the stats by a given amount of time. I am doing it this way too.
Add at TOP:
Add at OnPlayerConnect:
Add at OnPlayerDisconnect:
At OnGameModeExit:
Add at bottom:
If you have any questions, feel free to ask.
Jeffry
I suggest you to take a timer which saves the stats by a given amount of time. I am doing it this way too.
Add at TOP:
pawn Код:
#define SAVE_TIME 30 //Will save the stats every 30 seconds.
new SaveTimer[MAX_PLAYERS] = {-1,...};
pawn Код:
SaveTimer[playerid] = SetTimerEx("SaveTheUser", SAVE_TIME*1000, 1, "d", playerid);
pawn Код:
if(SaveTimer[playerid] != -1) KillTimer(SaveTimer[playerid]);
SaveTimer[playerid] = -1;
pawn Код:
for(new i=0; i<MAX_PLAYERS; i++)
{
if(SaveTimer[i] != -1)
{
KillTimer(SaveTimer[i]);
SaveTimer[i] = -1;
}
}
pawn Код:
forward SaveTheUser(playerid);
public SaveTheUser(playerid)
{
SavePlayer(playerid);
//Just change the SavePlayer(playerid) to your stats-saving-function.
return 1;
}
Jeffry