SA-MP Forums Archive
MySQL - Top 10 - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: MySQL - Top 10 (/showthread.php?tid=253432)



MySQL - Top 10 - Unknown123 - 06.05.2011

How to get the players who has highest score? (load the score from MySQL) like:

10. Unknown123 - 1337 Score
9. Unknown321 - 1287 Score
ect....
1. Unknown1337 - 69 Score

pawn Code:
COMMAND:top10(playerid, params[])
{
    hmm
}



Re: MySQL - Top 10 - Calgon - 06.05.2011

Code:
SELECT * FROM `playerTable` WHERE `playerScore` > 0 ORDER BY `playerScore` DESC LIMIT 10
would be your query. I won't give you any more code since you haven't given us enough details (what plugin you're using, what fields you have, if you use threads, etc).


Re: MySQL - Top 10 - Zh3r0 - 06.05.2011

Oh thanks Calg00ne, I wanted to remove the ones with 0 stats from the list! Now I know how.


Re: MySQL - Top 10 - Unknown123 - 06.05.2011

Im using Strickenkid's plugin

SELECT * FROM `accounts` WHERE `Score` > 0 ORDER BY `Score` DESC LIMIT 10


Re: MySQL - Top 10 - Calgon - 06.05.2011

I can't help you if you're using that plugin then.


Re: Respuesta: Re: MySQL - Top 10 - Biesmen - 06.05.2011

Quote:
Originally Posted by anonymousx
View Post
What about G-sTyLeZzZ's MySQL Plugin?
pawn Code:
mysql_query("SELECT * FROM `playerTable` WHERE `playerScore` > 0 ORDER BY `playerScore` DESC LIMIT 10");
mysql_store_result();
//Code here
mysql_free_result();



Re: Respuesta: Re: MySQL - Top 10 - Kyle - 06.05.2011

Quote:
Originally Posted by Biesmen
View Post
pawn Code:
mysql_query("SELECT * FROM `playerTable` WHERE `playerScore` > 0 ORDER BY `playerScore` DESC LIMIT 10");
mysql_store_result();
//Code here
mysql_free_result();
All you added was store_result and free_result, This don't help at all!


Re: MySQL - Top 10 - Unknown123 - 06.05.2011

Please help ^


Re: MySQL - Top 10 - WackoX - 06.05.2011

Quote:
Originally Posted by Unknown123
View Post
Im using Strickenkid's plugin

SELECT * FROM `accounts` WHERE `Score` > 0 ORDER BY `Score` DESC LIMIT 10
Quary's are always the same, no matter what plugin you use.


Re: MySQL - Top 10 - Calgon - 06.05.2011

Quote:
Originally Posted by WackoX
View Post
Quary's are always the same, no matter what plugin you use.
I asked what plugin he was using and what fields he wanted, he never said the query might be different nor was it even implied.