Hi
Now I need help, because when my server online about 24 hours I don't know why but randomly if anybody connected this code start flooding, with
mysql_query.
And the server freezed ( no crashed ), and when anybody trying to join its stops at "Connecting to .."
My code is this:
pawn Код:
public OnPlayerConnect(playerid)
{
AccountInfo[playerid][SaveTick] = 0;
return 1;
}
// This timer called every 1000ms
public Update()
{
foreach(Player, i)
{
if(AccRegistered[i] == 1)
{
AccountInfo[i][SaveTick]++;
// Stats saved every 10 minutes
if(AccountInfo[i][SaveTick] > 600)
{
SavePlayerStats(i);
AccountInfo[i][SaveTick] = 0;
}
}
}
}
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,Minutes=%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);
return 1;
}