Raised This Month: $32 Target: $400
 8% 

SQL query is freezing players


Post New Thread Closed Thread   
 
Thread Tools Display Modes
Author Message
jackie12
Junior Member
Join Date: Oct 2009
Old 05-21-2017 , 13:44   SQL query is freezing players
#1

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);
		}
	}
jackie12 is offline
JusTGo
Veteran Member
Join Date: Mar 2013
Old 05-21-2017 , 15:02   Re: SQL query is freezing players
#2

post in source mod section.
__________________
JusTGo is offline
Sillium
AlliedModders Donor
Join Date: Sep 2008
Location: Germany
Old 05-22-2017 , 01:48   Re: SQL query is freezing players
#3

We will continue here:
https://forums.alliedmods.net/showth...77#post2522077
__________________
brb, dishes have developed their own language and are talking to the garbage about overthrowing me... i must correct this

www.unterwasserpyromanen.de
Sillium is offline
Closed Thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:54.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode