/top10 with mysql.
#8

I try to do but i don't know you to do and with your position? i try to do:

pawn Code:
mysql_query("SELECT Exp, Name FROM playerdata ORDER BY Exp DESC LIMIT 10");
mysql_store_result();
new id,output[512],username[24], scorevariable[5],tmpStr[64],tmpStr2[64];
while(mysql_retrieve_row())
{
id ++;
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);
}
format(tmpStr2, sizeof(tmpStr2), "Your position is %d of %d with %d XP",id,ReturnUserCount(),strval(scorevariable));
strcat(output, tmpStr2);
mysql_free_result();
ShowPlayerDialog(playerid, 8, DIALOG_STYLE_MSGBOX, "players top10", output, "OK", "");
return 1;
}
But,i don't get players for ex:

pawn Code:
Player1 = 2000XP
Player2 = 1000XP
I'am "Player1" and when i write /top10 i only get my

pawn Code:
1.Player1 2000XP
but i want to do that:

pawn Code:
1.Player1 2000XP
2.Player2 1000XP
pawn Code:
mysql_query("SELECT Exp, Name FROM playerdata ORDER BY Exp DESC LIMIT 10");
Then how "DESC LIMIT 10" and limit will be not 10,but that how much is registered players.
Reply


Messages In This Thread
/top10 with mysql. - by budelis - 09.09.2011, 11:16
Re: /top10 with mysql. - by [HiC]TheKiller - 09.09.2011, 12:14
[No subject] - by budelis - 10.09.2011, 07:55
Re: /top10 with mysql. - by Vince - 10.09.2011, 10:39
Re: /top10 with mysql. - by budelis - 10.09.2011, 12:09
Re: /top10 with mysql. - by [HiC]TheKiller - 10.09.2011, 12:26
Re: /top10 with mysql. - by Gh0sT_ - 10.09.2011, 12:30
[No subject] - by budelis - 10.09.2011, 13:25

Forum Jump:


Users browsing this thread: 3 Guest(s)