/top10 player in dialog_msgbox using Mysql latest with thread
#1

As the title say. Can you please help us make a /top10 command which get the player Kills or Score. For Example it would be look like this

Код HTML:
Server 10 Top //This is the dialog title

1. kbalor: 32
2. Killua:  29
3. Obeshi: 27
4. Ippo: 25
5. Naruto: 23
6. Gko: 20
7. and so on up to 10

Close //dialog msgbox close button
This is what my mysql


Код HTML:
#if USE_MYSQL == true
#define _THREAD_LOAD_PLAYER     (0)
Код HTML:
stock LoadPlayer(playerid)
{
     #if USE_MYSQL == true
     new query[634];
     format(query,sizeof(query),"SELECT   `XPos`,`YPos`,`ZPos`,`AdminLevel`,`VIPLevel`,`WantedLevel`,`Kills`,`Deaths`,`Money`,`Score`,`Health`,`Armour`,`Hours`,`Minutes`,`Seconds`,`KickCount`,`LastSkin`,`SpawnCount`,`ReportCount`,`RegDate` FROM `"#MYSQL_TABLE"` WHERE `PlayerName` = '%s'", GetName(playerid));
     if(mysql_ping(gSQL))
     {
          mysql_query(query, _THREAD_LOAD_PLAYER, playerid, gSQL);
     }
I have posted this because I haven't found any /top player that loads using this new one. This thread will also help other forum members if they have similar things about /top player
Reply
#2

Hi anyone how to make this right?
Reply
#3

Still waiting for an kindly reply. I really wanted to finished this. Please I need your help guys

Just top 5 players if you csnt do top 10. Please
Reply
#4

First, start off with this query:

pawn Код:
SELECT `Score`, `PlayerName` FROM `"#MYSQL_TABLE"` ORDER BY `Score` ASC LIMIT 10
Example:

pawn Код:
new
    count = 10,
    result[2][32],
    string[(24 + 10) * 10];

mysql_query("SELECT `Score`, `PlayerName` FROM `"#MYSQL_TABLE"` ORDER BY `Score` ASC LIMIT 10");
mysql_store_result();

if (mysql_num_rows() < 1) return 0;

while (mysql_retrieve_row() && count > 0)
{
    mysql_fetch_field_row(result[0], "Score");
    mysql_fetch_field_row(result[1], "PlayerName");

    format(string, sizeof(string), "%s%d. %s: %d\n", string, count--, result[1], strval(result[0]));
}
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "Top 10", string, "Close", "");
Reply
#5

I got this following error:

undefined symbol "mysql_query"

And do I need to make a, thread, check or fetch? For checking and showing the name and score?

Coz basically my player save/load and other things are made from thread. Samples

_THREAD_LOAD_PLAYER
_THREAD_SAVE_PLAYER
_THREAD_CREATE_PLAYER
_THREAD_ACCOUNT_EXIST
_FETCH_PLAYER_INFO
_FETCH_BAN_STAT_
_CHECK_PASSWORD

And sample for the case of _Thread_Load_Player

case _THREAD_LOAD_PLAYER
{
mysql_store_result();
If(mysql_num_rows(gSQL) > 0)
{
New resultline[512], score, money,wanted;
mysql_fetch_row_format (resultline);
if(sscsnf(resultline, "p<|>fffdddddddffddddddddddds[16]",
PlayerInfo[extraid][Xpos],
And so on...

Im on my mobile

EDIT:::::::

I replaced mysql_query to mysql_funtion_query but it gives argument type mismatch(argument 1)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)