[HELP]Mysql : Getting the top player.
#3

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
Reply


Messages In This Thread
[HELP]Mysql : Getting the top player. - by MrViolence101 - 09.12.2014, 23:26
Re: [HELP]Mysql : Getting the top player. - by BlackWolf120 - 09.12.2014, 23:44
Re: [HELP]Mysql : Getting the top player. - by MrViolence101 - 09.12.2014, 23:52
Re: [HELP]Mysql : Getting the top player. - by MrViolence101 - 09.12.2014, 23:54
Re: [HELP]Mysql : Getting the top player. - by BlackWolf120 - 09.12.2014, 23:57
Re: [HELP]Mysql : Getting the top player. - by BlackWolf120 - 10.12.2014, 00:02
Re: [HELP]Mysql : Getting the top player. - by SickAttack - 10.12.2014, 00:43

Forum Jump:


Users browsing this thread: 1 Guest(s)