05.09.2017, 21:05
Hey, I'm not the most advanced scripter, actually I've started scripting recently, and I don't know how can I resolve this problem: I want to make it so a player can see his position in the leaderboards, for example, "You are currently in position %d out of %d with %d score!", however I don't know how to get the players position in the leaderboard, everything else works fine. The code is below
Код:
CMD:yourpos(playerid, params[]) { new query[128]; format(query, sizeof(query), "SELECT score, nick FROM playerdata ORDER BY score"); mysql_query(query); mysql_store_result(); new tmpstr[60], p; while(mysql_fetch_row(query)) { mysql_fetch_field("nick", pInfo[playerid][Nick]); mysql_fetch_int("score", pInfo[playerid][pScore]); p++; format(tmpstr, sizeof(tmpstr), "You are currently %d out of %d with %d score!", p, ReturnUserCount(), GetPlayerScore(playerid)); ShowPlayerDialog(playerid, 79, DIALOG_STYLE_MSGBOX, "{10F441}Your score..", tmpstr, "Close", ""); } return 1; }