help top10
#1

Hi all.I want to ask one thing.I have do and almost finish me /top10 with mysql.But the first player name not exit it look like that:

Код:
1. 10000XP
2.Player 500XP
3.Player5 200XP
4.Player6 100XP
5.Player7 50XP
6.Player8 25XP
and how you see in here:

Код:
1. (here is no name) 10000XP
Reply
#2

We need to see the code. We can't guess what the problem is.
Reply
#3

Код:
mysql_query("SELECT Name,Exp FROM playerdata ORDER BY Exp DESC LIMIT 10");
mysql_store_result();
new ID,output[ 512 ],tmpStr[64];
while(mysql_retrieve_row())
{
ID ++;
new username[24], scorevariable[5];
mysql_fetch_field_row(username, "Name");
mysql_fetch_field_row(scorevariable, "Exp");
format(tmpStr, sizeof(tmpStr), "%d. %s %d XP\n", ID,username,strval(scorevariable));
strcat( output, tmpStr );
}
mysql_free_result();
ShowPlayerDialog(playerid, 8, DIALOG_STYLE_MSGBOX, "players top10", output, "OK", "");
Reply
#4

Try using format() instead of strcat.
Reply
#5

Don't work.
Reply
#6

I had that problem to on richest players, but it solved itself after some time.
Reply
#7

Try this:
pawn Код:
mysql_query("SELECT Name,Exp FROM playerdata ORDER BY Exp DESC LIMIT 10");
mysql_store_result();

new
    ID,
    output[512];

while(mysql_retrieve_row())
{
    ID ++;

    new
        username[24],
        scorevariable[5];

    mysql_fetch_field_row(username, "Name");
    mysql_fetch_field_row(scorevariable, "Exp");

    format(output, sizeof(output), "%s%d. %s %d XP\n", output, ID, username, strval(scorevariable));
}
mysql_free_result();

ShowPlayerDialog(playerid, 8, DIALOG_STYLE_MSGBOX, "players top10", output, "OK", "");
Reply
#8

The same problem,first player name not show.....
Reply
#9

Maybe there's some wrong info in your database? Try running that query on navicat/phpMyadmin
Reply
#10

There is all good.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)