help top10 - 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)
+--- Thread: help top10 (
/showthread.php?tid=285291)
help top10 -
budelis - 23.09.2011
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
Re: help top10 -
MP2 - 23.09.2011
We need to see the code. We can't guess what the problem is.
Re: help top10 -
budelis - 23.09.2011
Код:
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", "");
Re: help top10 -
MP2 - 23.09.2011
Try using format() instead of strcat.
Re: help top10 -
budelis - 23.09.2011
Don't work.
Re: help top10 -
Richie - 23.09.2011
I had that problem to on richest players, but it solved itself after some time.
Re: help top10 - [L3th4l] - 23.09.2011
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", "");
Re: help top10 -
budelis - 24.09.2011
The same problem,first player name not show.....
Re: help top10 -
wups - 24.09.2011
Maybe there's some wrong info in your database? Try running that query on navicat/phpMyadmin
Re: help top10 -
budelis - 24.09.2011
There is all good.