/makeadmin, small problem.
#2

You can't have multiple else conditions, you need to use else if.

pawn Код:
CMD:makeadmin(playerid, params[])
{
    new id, level, file[256];
    if(IsPlayerAdmin(playerid))
    {
        if(sscanf(params, "ud", id, level))
            return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /makeadmin [playerid] [level 1-4]");
        else
        {
            if(level > 4)
                return SendClientMessage(playerid, COLOR_RED, "There are only 4 admin levels available!");
            else if(level >= 1)
            {
                if(fexist(file))
                    dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel] = 1), SendClientMessage(playerid, COLOR_YELLOW, "You have been promoted to admin level 1!");
            }
            else if(level >= 2)
            {
                if(fexist(file))
                    dini_IntSet(file, "AdminLevel", PlayerInfo[playerid][pAdminLevel] = 2), SendClientMessage(playerid, COLOR_YELLOW, "You have been promoted to admin level 2!");
            }
            else if(level >= 3)
            {
                if(fexist(file))
                    dini_IntSet(file, "AdminLevel", PlayerInfo[playerid][pAdminLevel] = 3), SendClientMessage(playerid, COLOR_YELLOW, "You have been promoted to admin level 3!");
            }
            else if(level >= 4)
            {
                if(fexist(file))
                    dini_IntSet(file, "AdminLevel", PlayerInfo[playerid][pAdminLevel] = 4), SendClientMessage(playerid, COLOR_YELLOW, "You have been promoted to developer / scripter!");
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED, "You must be an admin to promote someone!");
            }
        }
    }
    return 1;
}
Reply


Messages In This Thread
/makeadmin, small problem. - by zClaw - 31.05.2013, 14:52
Re: /makeadmin, small problem. - by GiamPy. - 31.05.2013, 14:55
Re: /makeadmin, small problem. - by zClaw - 31.05.2013, 14:57
Re: /makeadmin, small problem. - by GiamPy. - 31.05.2013, 14:59
Re: /makeadmin, small problem. - by [ABK]Antonio - 31.05.2013, 15:05
Re: /makeadmin, small problem. - by zClaw - 31.05.2013, 15:45
Re: /makeadmin, small problem. - by Konstantinos - 31.05.2013, 15:47
Re: /makeadmin, small problem. - by [ABK]Antonio - 31.05.2013, 15:48
Re: /makeadmin, small problem. - by zClaw - 31.05.2013, 19:28
Re: /makeadmin, small problem. - by RalphHaro - 31.05.2013, 19:57

Forum Jump:


Users browsing this thread: 1 Guest(s)