/setadmin command help
#2

Untested but tell me if this works:

pawn Код:
CMD:setadmin(playerid, params[])
{
    new id, adminlevel,MyRank[32],HisRank[32],MyName[32],HisName[32];
    if(PlayerInfo[playerid][pAdmin] <= 4) return SendClientMessage(playerid, COLOR_SILVER, "You must be atleast a Community Owner to use this command!");
    else if(sscanf(params, "ud", id, adminlevel)) return SendClientMessage(playerid, COLOR_SILVER, "Syntax: /setadmin [PlayerID][Admin Level]");
    else if(adminlevel < 0 || adminlevel > 5) return SendClientMessage(playerid, COLOR_SILVER, "Error: Must be level 1-5!");
    else
    {
        if(PlayerInfo[id][pAdmin] == adminlevel) return SendClientMessage(playerid, COLOR_SILVER, "Error: This player is already that level!");
        else
        {
            GetPlayerName(playerid,MyName,32);
            GetPlayerName(id,HisName,32);
            PlayerInfo[id][pAdmin] = adminlevel;
            if(PlayerInfo[playerid][pAdmin] == 1){MyRank = "Moderator";}
            if(PlayerInfo[playerid][pAdmin] == 2){MyRank = "Trial Administrator";}
            if(PlayerInfo[playerid][pAdmin] == 3){MyRank = "Administrator";}
            if(PlayerInfo[playerid][pAdmin] == 4){MyRank = "Lead Administrator";}
            if(PlayerInfo[playerid][pAdmin] == 5){MyRank = "Community Owner";}

            if(PlayerInfo[id][pAdmin] == 1){HisRank = "Moderator";}
            if(PlayerInfo[id][pAdmin] == 2){HisRank = "Trial Administrator";}
            if(PlayerInfo[id][pAdmin] == 3){HisRank = "Administrator";}
            if(PlayerInfo[id][pAdmin] == 4){HisRank = "Lead Administrator";}
            if(PlayerInfo[id][pAdmin] == 5){HisRank = "Community Owner";}

            new string[128];
            format(string, sizeof(string), "[AdmCmd] %s %s(ID:%d) had made %s(ID:%d) a %s",MyRank,MyName,playerid,HisName,id,HisRank);
            SendClientMessageToAll(COLOR_YELLOW,string);

        }
    }
    return 1;
}
This is one way of making it, you could have a way using a function.
Reply


Messages In This Thread
/setadmin command help - by Anjh - 05.04.2013, 17:30
Re: /setadmin command help - by Shockey HD - 05.04.2013, 18:31
Re: /setadmin command help - by Anjh - 05.04.2013, 18:46
Re: /setadmin command help - by nor15 - 05.04.2013, 18:51
Re: /setadmin command help - by Shockey HD - 05.04.2013, 18:51
Re: /setadmin command help - by Anjh - 05.04.2013, 18:59
Re: /setadmin command help - by BigGroter - 05.04.2013, 20:34

Forum Jump:


Users browsing this thread: 5 Guest(s)