Senior Member
Join Date: May 2006
Location: Sweden
|
05-21-2009
, 02:01
Re: AMXX Psychostats
|
#9
|
This
PHP Code:
if(SQL_MoreResults(query)) { rank = SQL_ReadResult(query, 0) ranked = SQL_ReadResult(query, 1) kills = SQL_ReadResult(query, 2) deaths = SQL_ReadResult(query, 3) hits = SQL_ReadResult(query, 4) skill = SQL_ReadResult(query, 5) accuracy = SQL_ReadResult(query, 6) client_print(id, print_chat, "*** Your rank is %d of %d with %d kills, %d deaths, %d hits, %d skill and have %d %s accuracy", rank, ranked, kills, deaths, hits, skill, accuracy, PERCENT) client_print(id, print_console, "*** Your rank is %d of %d with %d kills, %d deaths, %d hits, %d skill and have %d %s accuracy", rank, ranked, kills, deaths, hits, skill, accuracy, PERCENT) }
should be like this since there is only 1 result you retrive.
PHP Code:
if(SQL_NumResults(query)) { rank = SQL_ReadResult(query, 0) ranked = SQL_ReadResult(query, 1) kills = SQL_ReadResult(query, 2) deaths = SQL_ReadResult(query, 3) hits = SQL_ReadResult(query, 4) skill = SQL_ReadResult(query, 5) accuracy = SQL_ReadResult(query, 6) client_print(id, print_chat, "*** Your rank is %d of %d with %d kills, %d deaths, %d hits, %d skill and have %d %s accuracy", rank, ranked, kills, deaths, hits, skill, accuracy, PERCENT) client_print(id, print_console, "*** Your rank is %d of %d with %d kills, %d deaths, %d hits, %d skill and have %d %s accuracy", rank, ranked, kills, deaths, hits, skill, accuracy, PERCENT) }
And this
PHP Code:
for(new i; i < topX; i++) { rank = SQL_ReadResult(query, 0) SQL_ReadResult(query, 1, name, sizeof name -1) kills = SQL_ReadResult(query, 2) deaths = SQL_ReadResult(query, 3) hits = SQL_ReadResult(query, 4) shots = SQL_ReadResult(query, 5) headshotkills = SQL_ReadResult(query, 6) skill = SQL_ReadResult(query, 7) accuracy = SQL_ReadResult(query, 8) onlinetime = SQL_ReadResult(query, 9) len += formatex(motd[len], sizeof motd -1 - len, "^n%2d %-22.22s %6d %6d %7d %8d %4d %3.0d% %3.0d%% %4.0dh", rank, name, kills, deaths, hits, shots, headshotkills, skill, accuracy, onlinetime) SQL_NextRow(query) }
you can change to this
PHP Code:
while(SQL_MoreResults(query)) { rank = SQL_ReadResult(query, 0) SQL_ReadResult(query, 1, name, sizeof name -1) kills = SQL_ReadResult(query, 2) deaths = SQL_ReadResult(query, 3) hits = SQL_ReadResult(query, 4) shots = SQL_ReadResult(query, 5) headshotkills = SQL_ReadResult(query, 6) skill = SQL_ReadResult(query, 7) accuracy = SQL_ReadResult(query, 8) onlinetime = SQL_ReadResult(query, 9) len += formatex(motd[len], sizeof motd -1 - len, "^n%2d %-22.22s %6d %6d %7d %8d %4d %3.0d% %3.0d%% %4.0dh", rank, name, kills, deaths, hits, shots, headshotkills, skill, accuracy, onlinetime) SQL_NextRow(query) }
I have done alot of stuff with sqlx and i have found out that regular querys will lag the server everytime they get executed if you have more than a few players on the servers, i always use threded querys in functions that is used during gameplay, even if the mysql server is on the same computer as the gameserver you will get lag from regular querys during gameplay.
And the way to show a longer top list is to use a php webpage to show the top list in motd, then you get rid of the querys from the gameserver also since you run them in the php file, not everyone has a webserver but for those who have that is a much better solution.
__________________
Last edited by Gizmo; 05-21-2009 at 02:06.
|
|