Quote:
Originally Posted by BlackWolf120
just order the mysql table by the players score. (DESC: from highest score to the lowest score)
Get the first entry then (as this is the player with the highest score then obviously) and display it the way u want.
A quick example i just made for you:
pawn Код:
if (strcmp("/topplayer", cmdtext, true) == 0) { new p_top[24],score,string[64],row[36]; mysql_query("SELECT name, score FROM table ORDER BY score DESC Limit 1"); mysql_store_result(); mysql_fetch_row(row); sscanf(row, "p<|>s[24]d",p_top,score); format(string, sizeof string, "Top Player: %s | Score: %d",p_top,score); mysql_free_result(); ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX,"Top Player", string, "Close", ""); return 1; }
Note: Its just an example, the mysql functions may differ from plugin to plugin but the logic remains the same
regards, wolf.
|
going to be a slight problem, because it will still give me a undefined function error. like mysql_free_result and mysql_fetch_row wont work