Hello guys,
I've got little problem. On every round end I am updating in my database players stats (kills,assists,deaths,mvp). While script to update is running, it is freezing for 0.5 sec every player. How can I solve it? Thank you ... here is code
Code:
RoundsWon_T = CS_GetTeamScore(CS_TEAM_T);
RoundsWon_CT = CS_GetTeamScore(CS_TEAM_CT);
for (int i = 1; i <= MaxClients; i++)
{
if (IsClientValid(i)) {
new String:query[255];
new String:auth[32];
new String:part[25];
GetClientAuthId(i, AuthId_Steam2, auth, sizeof(auth), false);
new index = StrContains( auth, ":" );
index += strlen( ":" );
strcopy( part, sizeof(part), auth[ index ] );
Format(query, 255, "UPDATE allowed_players SET frags='%i', assists='%i', deaths='%i', mvp='%i', win_rounds='%i' WHERE match_id='%i' AND steamid='%s' LIMIT 1", GetClientFrags(i), CS_GetClientAssists(i), GetClientDeaths(i), CS_GetMVPCount(i), GetClientTeam(i) == CS_TEAM_CT ? RoundsWon_CT : RoundsWon_T, matchId, part);
SQL_Query(db, query);
}
}