help me for command :((
#7

pawn Код:
CMD:makeadmin(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] >= 1337) {
        new para1,level;

        if (sscanf(params, "ud", para1, level)) {
            SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /makeadmin [playerid/PartOfName] [level(1-3)]");
            return 1;
        }
   
        new string[128], giveplayer[MAX_PLAYER_NAME],sendername[MAX_PLAYER_NAME];
        GetPlayerName(para1, giveplayer, sizeof(giveplayer));
        GetPlayerName(playerid, sendername, sizeof(sendername));
       
        PlayerInfo[para1][pAdmin] = level;
       
        printf("AdmCmd: %s has promoted %s to a level %d admin.", sendername, giveplayer, level);
       
        format(string, sizeof(string), "   You have been promoted to a level %d admin by %s", level, sendername);
        SendClientMessage(para1, COLOR_LIGHTBLUE, string);
       
        format(string, sizeof(string), "   You have promoted %s to a level %d admin.", giveplayer,level);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    } else {
        SendClientMessage(playerid, COLOR_GRAD1, "   you are not authorized to use that command!");
    }
   
    return 1;
}
You had a ton of useless if statements in your code. Try and think logically when writing commands. If a player is sending a command, obviously they are connected. No need to check for things like that.
Reply


Messages In This Thread
help me for command :(( - by eXtr1kE - 03.10.2010, 14:07
Re: help me for command :(( - by Memoryz - 03.10.2010, 14:10
Re: help me for command :(( - by MadeMan - 03.10.2010, 14:16
Re: help me for command :(( - by Stefan_Toretto - 03.10.2010, 14:18
Re: help me for command :(( - by eXtr1kE - 03.10.2010, 14:19
Re: help me for command :(( - by mmrk - 03.10.2010, 14:21
Re: help me for command :(( - by samgreen - 03.10.2010, 14:29
Re: help me for command :(( - by Mike_Peterson - 03.10.2010, 14:34
Re: help me for command :(( - by samgreen - 03.10.2010, 14:44

Forum Jump:


Users browsing this thread: 1 Guest(s)