SA-MP Forums Archive
command CMD: ranks dont work - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: command CMD: ranks dont work (/showthread.php?tid=641407)



command CMD: ranks dont work - DeX24 - 15.09.2017

CMD:ranks(playerid)
{
new string[156], dialogstr[sizeof(string) * sizeof(gRank)];
strcat(dialogstr, "Rank\tRank name\tScore\n");
for(new i; i < sizeof(gRank); i++)
{
if(GetPlayerRank(playerid) >= i) format(string, sizeof(string), ""SAMP_BLUE"%i.\t"SAMP_BLUE"%s\t"SAMP_BLUE"%i+ score\n", i, gRank[i][r_name], gRank[i][r_score]);
else format(string, sizeof(string), ""GREY"%i.\t"GREY"%s\t"GREY"%i+ score\n", i, gRank[i][r_name], gRank[i][r_score]);
strcat(dialogstr, string);

ShowPlayerDialog(playerid, DIALOG_COMMON, DIALOG_STYLE_TABLIST_HEADERS, "Ranks list", dialogstr, "Close", "");
return 1;
}







THAT S THE COMMAND BUT IN-GAME IT SAYS UNKNOWN COMMAND ! PLEASE HELP
I ADDED SOME RANKS THAT WORKS IN GAME WITH /RANK BUT I CANT SEE THE RANK LIST WTF


Re: command CMD: ranks dont work - Meller - 15.09.2017

Please don't go all caps and please, start using the [PHP] or at least [CODE] tag for PAWN codes in the forums..
However, here's a fixed code:

PHP код:
CMD:ranks(playerid) {
    new 
string[156], dialogstr[sizeof(string) * sizeof(gRank)];
    
strcat(dialogstr"Rank\tRank name\tScore\n");
    for(new 
isizeof(gRank); i++) {
        if(
GetPlayerRank(playerid) >= i)
                
format(stringsizeof(string), ""SAMP_BLUE"%i.\t"SAMP_BLUE"%s\t"SAMP_BLUE"%i+ score\n"igRank[i][r_name], gRank[i][r_score]);
        else
            
format(stringsizeof(string), ""GREY"%i.\t"GREY"%s\t"GREY"%i+ score\n"igRank[i][r_name], gRank[i][r_score]);
    }
    
strcat(dialogstrstring);
    
ShowPlayerDialog(playeridDIALOG_COMMONDIALOG_STYLE_TABLIST_HEADERS"Ranks list"dialogstr"Close""");
    return 
1;

You should've received lots of errors over missing the closing bracket of the for() loop; at line 9.

Mhm-.


Re: command CMD: ranks dont work - DeX24 - 15.09.2017

wow...omg i love you +rep

ok i dont get the errors but the command dont work..


Re: command CMD: ranks dont work - DeX24 - 15.09.2017

i dont know what to do


Re: command CMD: ranks dont work - Meller - 15.09.2017

First off, stop bumping after literally 7 minutes, be patient.

Start with debugging the cells, the strings, the dialog ID, check the limits.

Don't expect us to do everything for you G'.


Re: command CMD: ranks dont work - DeX24 - 15.09.2017

i dont understand why it s saying unknown command...it should work but it doesnt


Re: command CMD: ranks dont work - Meller - 15.09.2017

Quote:
Originally Posted by DeX24
Посмотреть сообщение
i dont understand why it s saying unknown command...it should work but it doesnt
Then make sure that you've read the documentation of whatever command proccessor you're using, make sure you don't return false where you shouldn't and so on. We can't guess from whatever code you've got that you're not providig us with; what's the problem. You gotta do some things yourself.