Quote:
Originally Posted by Sma_X
Код:
AccountInfo[i][SaveTick]++;
// Stats saved every 10 minutes
if(AccountInfo[i][SaveTick] > 600)
Then, every time it's bigger than 600 if you don't reset it .. and it's just still updating.
perhaps if you reset the value of AccountInfo[i][SaveTick] ..
try this and see if it works
Quote:
stock SavePlayerStats(playerid)
{
new name[MAX_PLAYER_NAME],
query[300];
GetPlayerName(playerid, name, sizeof(name));
// This code start flooding when XY connected to the server, and I think thats a reason for the server get freezed
format(query,sizeof(query),"UPDATE `users` SET Score=%d,Kills=%d,Deaths=%d,RaceWon=%d,PickupFound =%d,KillingSpree=%d,Weeks=%d,Days=%d,Hours=%d,Minu tes=%d,Color=%d,Money=%d WHERE (Username = '%s')",
GetPlayerScore(playerid), AccountInfo[playerid][Kills], AccountInfo[playerid][Deaths], AccountInfo[playerid][RaceWon], AccountInfo[playerid][PickupFound], AccountInfo[playerid][KillingSprees], AccountInfo[playerid][Weeks], AccountInfo[playerid][Days], AccountInfo[playerid][Hours], AccountInfo[playerid][Minutes], AccountInfo[playerid][Color], GetPlayerMoneyEx(playerid), name);
mysql_query(query);
AccountInfo[playerid][SaveTick] = 0; // reset the value at 0
return 1;
}
|
but just a question .. why don't you create the timer at 10 minutes then, instead of one at 1 sec and just keep incrementing that value?
|
but gets reseted to 0:
pawn Код:
if(AccountInfo[i][SaveTick] > 600)
{
SavePlayerStats(i)
AccountInfo[i][SaveTick] = 0; // Reset SaveTick
}
I have some code in this timer, and I don't saving all players stats same time the savetick is because of this.
Up: But the timer is runing every 1000ms, and in the mysql log I see the qouery sended about ~10 times / second