06.12.2010, 13:39
It's always a good idea to use a timer and save player stats every so often, but you have an interval of 10 seconds here. So every 10 seconds, player stats will be saved. If you don't know already, you'll be in for a rude awakening when you get about 10 players online. You should save stats once every hour, or even 2 hours. Every 10 seconds is just a joke.
pawn Код:
SetTimer("AutoSave",3600000,true); // Every 1 hour, this timer will repeat and perform the functions below.
public AutoSave()
{
for(new playerid;playerid<MAX_PLAYERS;playerid++)
{
dini_IntSet(udb_encode(nameee), "money", GetPlayerMoney(playerid));
dini_IntSet(udb_encode(nameee), "score", GetPlayerScore(playerid));
dini_IntSet(udb_encode(nameee), "rank", rank[playerid]);
dini_IntSet(udb_encode(nameee), "deaths", deaths[playerid]);
dini_IntSet(udb_encode(nameee), "kills", kills[playerid]);
dini_IntSet(udb_encode(nameee), "piolet", piolet[playerid]);
dini_IntSet(udb_encode(nameee), "logged", 1);
dini_IntSet(udb_encode(nameee), "adminlevel",adminlevel[playerid]);
dini_IntSet(udb_encode(nameee), "totalbans",bans[playerid]);
}
SendClientMessageToAll(0xFF0000FF, "All Player Stats Saved!");
return 1;
}