View Single Post
Gizmo
Senior Member
Join Date: May 2006
Location: Sweden
Old 05-21-2009 , 02:01   Re: AMXX Psychostats
Reply With Quote #9

This
PHP Code:
        if(SQL_MoreResults(query)) 
        {
            
rank SQL_ReadResult(query0)
            
ranked SQL_ReadResult(query1)
            
kills SQL_ReadResult(query2)
            
deaths SQL_ReadResult(query3)
            
hits SQL_ReadResult(query4)
            
skill SQL_ReadResult(query5)
            
accuracy SQL_ReadResult(query6)
            
            
client_print(idprint_chat"*** Your rank is %d of %d with %d kills, %d deaths, %d hits, %d skill and have %d %s accuracy"rankrankedkillsdeathshitsskillaccuracyPERCENT)
            
client_print(idprint_console"*** Your rank is %d of %d with %d kills, %d deaths, %d hits, %d skill and have %d %s accuracy"rankrankedkillsdeathshitsskillaccuracyPERCENT)
        } 
should be like this since there is only 1 result you retrive.
PHP Code:
        if(SQL_NumResults(query)) 
        {
            
rank SQL_ReadResult(query0)
            
ranked SQL_ReadResult(query1)
            
kills SQL_ReadResult(query2)
            
deaths SQL_ReadResult(query3)
            
hits SQL_ReadResult(query4)
            
skill SQL_ReadResult(query5)
            
accuracy SQL_ReadResult(query6)
            
            
client_print(idprint_chat"*** Your rank is %d of %d with %d kills, %d deaths, %d hits, %d skill and have %d %s accuracy"rankrankedkillsdeathshitsskillaccuracyPERCENT)
            
client_print(idprint_console"*** Your rank is %d of %d with %d kills, %d deaths, %d hits, %d skill and have %d %s accuracy"rankrankedkillsdeathshitsskillaccuracyPERCENT)
        } 
And this
PHP Code:
        for(new itopXi++)  
        {
            
rank SQL_ReadResult(query0)
            
SQL_ReadResult(query1namesizeof name -1)
            
kills SQL_ReadResult(query2)
            
deaths SQL_ReadResult(query3)
            
hits SQL_ReadResult(query4)
            
shots SQL_ReadResult(query5)
            
headshotkills SQL_ReadResult(query6)
            
skill SQL_ReadResult(query7)
            
accuracy SQL_ReadResult(query8)
            
onlinetime SQL_ReadResult(query9)
            
            
len += formatex(motd[len], sizeof motd -len"^n%2d %-22.22s %6d %6d %7d %8d %4d %3.0d% %3.0d%% %4.0dh"ranknamekillsdeathshitsshotsheadshotkillsskillaccuracyonlinetime)
            
            
SQL_NextRow(query)
        } 
you can change to this

PHP Code:
        while(SQL_MoreResults(query))  
        {
            
rank SQL_ReadResult(query0)
            
SQL_ReadResult(query1namesizeof name -1)
            
kills SQL_ReadResult(query2)
            
deaths SQL_ReadResult(query3)
            
hits SQL_ReadResult(query4)
            
shots SQL_ReadResult(query5)
            
headshotkills SQL_ReadResult(query6)
            
skill SQL_ReadResult(query7)
            
accuracy SQL_ReadResult(query8)
            
onlinetime SQL_ReadResult(query9)
            
            
len += formatex(motd[len], sizeof motd -len"^n%2d %-22.22s %6d %6d %7d %8d %4d %3.0d% %3.0d%% %4.0dh"ranknamekillsdeathshitsshotsheadshotkillsskillaccuracyonlinetime)
            
            
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.
Gizmo is offline