Top 10 small problem
#1

pawn Код:
CMD:top10(playerid, params[])
{
if(PlayerInfo[playerid][Jailed] == 1) return SCM(playerid,0xFF0000FF,"You can't use this command in jail.");
if(GetPVarInt(playerid, "spawned") == 0) return SCM(playerid, COLOR_LIGHTBLUE, "Please spawn before doing any action.");
if(pAlive[playerid] == 0) return SCM(playerid, COLOR_LIGHTBLUE, "You can't use this command if you are dead.");
mysql_query("SELECT user, Scores FROM `playerdata` ORDER BY `Scores` DESC LIMIT 10");
mysql_store_result();
new num, top[10][24], score[10][10];
while(mysql_retrieve_row())
{
    mysql_fetch_field_row(top[num], "user");
    mysql_fetch_field_row(score[num], "Scores");
    num++;
}
mysql_free_result();
new temp[1500];
new info[1500];
format(temp, sizeof(temp), "{FFFFFF}1): %s with {A1C2FF}%d score\n",top[0], score[0]);
strcat(info, temp);

format(temp, sizeof(temp), "{FFFFFF}2): %s with {A1C2FF}%d score\n",top[1], strval(score[1]));
strcat(info, temp);

format(temp, sizeof(temp), "{FFFFFF}3): %s with {A1C2FF}%d score\n",top[2], strval(score[2]));
strcat(info, temp);

format(temp, sizeof(temp), "{FFFFFF}4): %s with {A1C2FF}%d score\n",top[3], strval(score[3]));
strcat(info, temp);

format(temp, sizeof(temp), "{FFFFFF}5): %s with {A1C2FF}%d score\n",top[4], strval(score[4]));
strcat(info, temp);

format(temp, sizeof(temp), "{FFFFFF}6): %s with {A1C2FF}%d score\n",top[5], strval(score[5]));
strcat(info, temp);

format(temp, sizeof(temp), "{FFFFFF}7): %s with {A1C2FF}%d score\n",top[6], strval( score[6]));
strcat(info, temp);

format(temp, sizeof(temp), "{FFFFFF}8): %s with {A1C2FF}%d score\n",top[7], strval(score[7]));
strcat(info, temp);

format(temp, sizeof(temp), "{FFFFFF}9): %s with {A1C2FF}%d score\n",top[8], strval(score[8]));
strcat(info, temp);

format(temp, sizeof(temp), "{FFFFFF}10): %s with {A1C2FF}%d score\n",top[9], strval(score[9]));
strcat(info, temp);
ShowPlayerDialog(playerid, DIALOG_TOP_PLAYERS, DIALOG_STYLE_MSGBOX,"{53C506}Battlefield War Heroes - Top 10",info,"Close","");
return 1;
}
Got an "argument type mismatch here":
pawn Код:
mysql_query("SELECT user, Scores FROM `playerdata` ORDER BY `Scores` DESC LIMIT 10");
I'm using BlueG's R34.
Reply
#2

pawn Код:
mysql_query(ConnectionHandle, "SELECT user, Scores FROM `playerdata` ORDER BY `Scores` DESC LIMIT 10");
And a small suggestion:
Open the a_mysql.inc include file and check which commands have the ConnectionHandle variable.
Most have it set to 1 by default, but you may want to use the parameter anyway to prevent bugs.

Especially if you have more connections open, the connectionhandle won't be 1 in such cases.
Reply
#3

Thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)