What is wrong? Unknown command
#3

This code is just too bad. You should really convert all of your codes to dcmd/zcmd functions, and what was thinking when writing this code?! Why the hell do you use such a huge arrays?
pawn Код:
new adminstring1[2000];
            new adminstring2[2000];
            new adminstring3[2000];
            new adminstring4[2000];
            new adminstring5[2000];
            new adminstring6[2000];
The first string's length should be no more then 128, and after reducing the string's array, calculate what size each string needs. That would be much better instead setting 6 200 length strings.

Edit:
Quote:
Originally Posted by iggy1
Посмотреть сообщение
That is some realy awefull code them strings are gigantic!!!! Ill fix it cuz i'm bored. You also don't need to check if the player is connected because a player that isn't connected can't use commands!

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "ahelp", true) || !strcmp(cmdtext, "ah", true))
    {
        new
            admstr[264];
        if (PlayerInfo[playerid][pAdmin] == 1)
        {
            format(admstr, sizeof(admstr), "[Trial Admin 1] /check /setint /mute /kick /warn /ban /goto /cnn /a(dmin) chat /fine /cc");
            ShowPlayerDialog(playerid, 2, 0, "[Trial Admin 1]", admstr, "Ok" ,"");
            return 1;
        }
               
        if (PlayerInfo[playerid][pAdmin] == 2)
        {
            format(admstr, sizeof(admstr), "%s\n[Administrator 2] /skydive /setteam /bigears /cnn /freeze /unfreeze /recon /cam",admstr);
            ShowPlayerDialog(playerid, 2, 0, "[Administrator 2]", admstr, "Ok", "");
            return 1;
        }
               
        if (PlayerInfo[playerid][pAdmin] == 3)
        {
            format(admstr, sizeof(admstr), "%s\n[Senior Admin 3] /endround /mark /gotomark /gotolv /gotosf /gethere /oldcar /gotocar /getcar /noooc /fourdive /sp /gotols /jail /prison",admstr);
            ShowPlayerDialog(playerid, 2, 0, "[Senior Admin 3]", admstr, "Ok" ,"");
            return 1;
        }
               
        if (PlayerInfo[playerid][pAdmin] == 4)
        {
            format(admstr, sizeof(admstr), "%s\n[Lead Admin 4] /mole /hq /edit /fuelcars /asellhouse /asellbiz /sellsbiz /mk /sethp /setarmor /givegun /givemoney /setstat /setfamily",admstr);
            ShowPlayerDialog(playerid, 2, 0, "[Lead Admin 4]", admstr, "Ok" ,"");
            return 1;
        }
               
        if (PlayerInfo[playerid][pAdmin] == 5)
        {
            format(admstr, sizeof(admstr), "%s\n[Co Owner 5] /weather /weatherall /tod /startlotto /jetpack /fakeban /fakekick /unban /loadmission /savemission",admstr);
            ShowPlayerDialog(playerid, 2, 0, "[Co-Owner 5]", admstr, "Ok","");
            return 1;
        }
               
        if (PlayerInfo[playerid][pAdmin] >= 6)
        {
            format(admstr, sizeof(admstr), "%s\n[Owner 6] /makeadmin /veh /fixveh /kickres /sban /skick /fpk /agl /destroycars /makeleader /am /givelevelall /rac /restart",admstr);
            ShowPlayerDialog(playerid, 2, 0, "[Owner 6]", admstr, "Ok", "");
            return 1;
        }
    }
    return 0;
}
That should work. But You don't need to format the admin string because an admin can only be one level. It'd probably be better if you make a seperate dialog for each level. W/o formating.
This is not gonna get the job done. Think of it, if a player is an admin of level 2, he won't be able to see the level 1-admin commands. What he was trying to do is to make that player with a higer admin level will be able to see their level - commands, and in addition the lower admin level commands.
Reply


Messages In This Thread
What is wrong? Unknown command - by Deathwing - 07.02.2011, 08:14
Re: What is wrong? Unknown command - by iggy1 - 07.02.2011, 08:18
Re: What is wrong? Unknown command - by _Tommy - 07.02.2011, 08:37
Re: What is wrong? Unknown command - by Deathwing - 07.02.2011, 08:43

Forum Jump:


Users browsing this thread: 1 Guest(s)