Raised This Month: $ Target: $400
 0% 

SQL Top


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
maza51
Senior Member
Join Date: Mar 2010
Old 01-29-2011 , 06:49   SQL Top
Reply With Quote #1

Hello. I'm trying to make the top 10 players' statistics.
And when I take the information to the players:
PHP Code:
Format(querysizeof(query), "SELECT * FROM 'Players' WHERE map ='%s'"currentMap); 
Then I want to write all of the chat:
PHP Code:
        decl String:Toptime[30];
        
decl String:Topname[30];
        
        
SQL_FetchString(hndl1Topnamesizeof(Topname));
        
SQL_FetchString(hndl2Toptimesizeof(Toptime));
        
        
PrintToChatAll("\x05%s %s"ToptimeTopname); 
And I wrote in the chat for all players, without sorting. How to sort them in descending order?
maza51 is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 01-29-2011 , 06:52   Re: SQL Top
Reply With Quote #2

http://dev.mysql.com/doc/refman/5.0/...imization.html
__________________
Silvers is offline
maza51
Senior Member
Join Date: Mar 2010
Old 01-29-2011 , 07:19   Re: SQL Top
Reply With Quote #3

PHP Code:
Format(querysizeof(query), "SELECT * FROM 'Players' ORDER BY time WHERE map ='%s'"currentMap); 
so?
maza51 is offline
Leonardo
Veteran Member
Join Date: Feb 2010
Location: 90's
Old 01-29-2011 , 07:48   Re: SQL Top
Reply With Quote #4

Quote:
Originally Posted by maza51 View Post
PHP Code:
Format(querysizeof(query), "SELECT * FROM 'Players' ORDER BY time WHERE map ='%s'"currentMap); 
PHP Code:
"SELECT * FROM `Players` WHERE `map` ='%s' ORDER BY `time` LIMIT 0, 10" 
Quote:
Originally Posted by maza51 View Post
How to check if the player is already in the database or not?
if SELECT query return 0 rows, so player isn't in DB
__________________
Leonardo is offline
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 01-29-2011 , 07:30   Re: SQL Top
Reply With Quote #5

Yeah, try it.
__________________
Silvers is offline
maza51
Senior Member
Join Date: Mar 2010
Old 01-29-2011 , 07:38   Re: SQL Top
Reply With Quote #6

Thank you. Work.

Another question.
How to check if the player is already in the database or not?
maza51 is offline
maza51
Senior Member
Join Date: Mar 2010
Old 01-29-2011 , 08:22   Re: SQL Top
Reply With Quote #7

A sample can be?
maza51 is offline
maza51
Senior Member
Join Date: Mar 2010
Old 01-29-2011 , 13:31   Re: SQL Top
Reply With Quote #8

Thanks Leonardo. Everything turned out =)
maza51 is offline
maza51
Senior Member
Join Date: Mar 2010
Old 02-04-2011 , 13:40   Re: SQL Top
Reply With Quote #9

I did statistics on the point.


How to make rank? To specify which positions are occupied by players.
maza51 is offline
Leonardo
Veteran Member
Join Date: Feb 2010
Location: 90's
Old 02-04-2011 , 18:07   Re: SQL Top
Reply With Quote #10

is it top10 ?
PHP Code:
new i=1;
while(
SQL_FetchRow(sQuery))
{
      ...
      
PrintToChat(iClient"#%i %s with %i pts"i++, sPlayerNameiPlayerPoints)

__________________
Leonardo is offline
Reply



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 11:36.


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