Top command (again)
#1

Ok forget last topic, whats wrong with this code?

pawn Код:
CMD:top(playerid, params[])
{
if(GetPVarInt(playerid,"CmdTime")>GetTickCount())return SCM(playerid,0xFF0000FF,"Please wait before using this command again.");
mysql_query("SELECT user, Scores FROM `playerdata` ORDER BY `Scores` DESC LIMIT 5");
mysql_query("SELECT user, Deaths FROM `playerdata` ORDER BY `Deaths` DESC LIMIT 5");
mysql_query("SELECT user, Cash FROM `playerdata` ORDER BY `Cash` DESC LIMIT 5");
mysql_query("SELECT user, Exp FROM `playerdata` ORDER BY `Exp` DESC LIMIT 5");
mysql_store_result();
new num, top[6][24], score[6][10], deaths[6][10], cash[6][20], exp[6][25];
while(mysql_retrieve_row())
{
    mysql_fetch_field_row(top[num], "user");
    mysql_fetch_field_row(score[num], "Scores");
    mysql_fetch_field_row(deaths[num], "Deaths");
    mysql_fetch_field_row(cash[num], "Cash");
    mysql_fetch_field_row(exp[num], "Exp");
    num++;
}
mysql_free_result();

    new temp[1500];
    new info[1500];

    //Score
    strcat(info,"{53C506}Top 5 players with most score:\n\n");
    format(temp, sizeof(temp), "{FFFFFF}N° 1: %s with {A1C2FF}%d Score \n", top[0], score[0]);
    strcat(info, temp);
    format(temp, sizeof(temp), "{FFFFFF}N° 2: %s with {A1C2FF}%d Score \n", top[1], strval(score[1]));
    strcat(info, temp);
    format(temp, sizeof(temp), "{FFFFFF}N° 3: %s with {A1C2FF}%d Score \n", top[2], strval(score[2]));
    strcat(info, temp);
    format(temp, sizeof(temp), "{FFFFFF}N° 4: %s with {A1C2FF}%d Score \n", top[3], strval(score[3]));
    strcat(info, temp);
    format(temp, sizeof(temp), "{FFFFFF}N° 5: %s with {A1C2FF}%d Score \n\n", top[4], strval(score[4]));
    strcat(info, temp);
   
    //Deaths
    strcat(info,"{53C506}Top 5 players with most deaths:\n\n");
    format(temp, sizeof(temp), "{FFFFFF}N° 1: %s with {A1C2FF}%d Deaths \n", top[0], deaths[0]);
    strcat(info, temp);
    format(temp, sizeof(temp), "{FFFFFF}N° 2: %s with {A1C2FF}%d Deaths \n", top[1], strval(deaths[1]));
    strcat(info, temp);
    format(temp, sizeof(temp), "{FFFFFF}N° 3: %s with {A1C2FF}%d Deaths \n", top[2], strval(deaths[2]));
    strcat(info, temp);
    format(temp, sizeof(temp), "{FFFFFF}N° 4: %s with {A1C2FF}%d Deaths \n", top[3], strval(deaths[3]));
    strcat(info, temp);
    format(temp, sizeof(temp), "{FFFFFF}N° 5: %s with {A1C2FF}%d Deaths \n\n", top[4], strval(deaths[4]));
    strcat(info, temp);
   
    //Cash
    strcat(info,"{53C506}Top 5 players with most deaths:\n\n");
    format(temp, sizeof(temp), "{FFFFFF}N° 1: %s with {A1C2FF}%i CSCash \n", top[0], cash[0]);
    strcat(info, temp);
    format(temp, sizeof(temp), "{FFFFFF}N° 2: %s with {A1C2FF}%i CSCash \n", top[1], strval(cash[1]));
    strcat(info, temp);
    format(temp, sizeof(temp), "{FFFFFF}N° 3: %s with {A1C2FF}%i CSCash \n", top[2], strval(cash[2]));
    strcat(info, temp);
    format(temp, sizeof(temp), "{FFFFFF}N° 4: %s with {A1C2FF}%i CSCash \n", top[3], strval(cash[3]));
    strcat(info, temp);
    format(temp, sizeof(temp), "{FFFFFF}N° 5: %s with {A1C2FF}%i CSCash \n\n", top[4], strval(cash[4]));
    strcat(info, temp);
   
    //Exp
    strcat(info,"{53C506}Top 5 players with most deaths:\n\n");
    format(temp, sizeof(temp), "{FFFFFF}N° 1: %s with {A1C2FF}%d Exp \n", top[0], exp[0]);
    strcat(info, temp);
    format(temp, sizeof(temp), "{FFFFFF}N° 2: %s with {A1C2FF}%d Exp \n", top[1], strval(exp[1]));
    strcat(info, temp);
    format(temp, sizeof(temp), "{FFFFFF}N° 3: %s with {A1C2FF}%d Exp \n", top[2], strval(exp[2]));
    strcat(info, temp);
    format(temp, sizeof(temp), "{FFFFFF}N° 4: %s with {A1C2FF}%d Exp \n", top[3], strval(exp[3]));
    strcat(info, temp);
    format(temp, sizeof(temp), "{FFFFFF}N° 5: %s with {A1C2FF}%d Exp \n", top[4], strval(exp[4]));
    strcat(info, temp);

    ShowPlayerDialog(playerid, DIALOG_TOP, DIALOG_STYLE_MSGBOX,"Top 5 BWH Players",info,"Close","");

SetPVarInt(playerid,"CmdTime",GetTickCount()+5000);
return true;
}
The top 5 score works, the other no. It shows always 0 even if i have more exp or cash or deaths than others.
Reply


Messages In This Thread
Top command (again) - by Face9000 - 05.01.2014, 23:28
Re: Top command (again) - by Eth - 05.01.2014, 23:44
Re: Top command (again) - by Face9000 - 06.01.2014, 09:53
Re: Top command (again) - by Konstantinos - 06.01.2014, 10:02
Re: Top command (again) - by Face9000 - 06.01.2014, 10:52
Re: Top command (again) - by Konstantinos - 06.01.2014, 10:55
Re: Top command (again) - by Face9000 - 06.01.2014, 12:16
Re: Top command (again) - by Face9000 - 07.01.2014, 18:18
Re: Top command (again) - by Face9000 - 08.01.2014, 20:32
Re: Top command (again) - by Vince - 08.01.2014, 20:42

Forum Jump:


Users browsing this thread: 10 Guest(s)