What is wrong? Unknown command
#2

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.
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)