A plea for aid.
#3

Here, I have finished it. I have compiled it and no errors.

pawn Code:
//Enums
enum pInfo
{
    pAdmin //Whatever your variable is..
}
new PlayerInfo[MAX_PLAYERS][pInfo];

//Stocks
GetAdminLevelName(playerid)
{
    new string[64];
    if(PlayerInfo[playerid][pAdmin] == 0) string = ("Not Admin"); //Not Admin
    if(PlayerInfo[playerid][pAdmin] == 1) string = ("Level 1"); //Change this
    if(PlayerInfo[playerid][pAdmin] == 2) string = ("Level 2"); //Change this
    if(PlayerInfo[playerid][pAdmin] == 3) string = ("Level 3"); //Change this
    if(PlayerInfo[playerid][pAdmin] == 4) string = ("Level 4"); //Change this
    if(PlayerInfo[playerid][pAdmin] == 5) string = ("Level 5"); //Change this
    return string;
}

//Commands
COMMAND:asetlevel(playerid, params[])
{
    new string[128], id, type;
    if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: You are not an Administrator!");

    if(PlayerInfo[playerid][pAdmin] == 1) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: You need to be a Level Five Administrator to use this command!");

    if(PlayerInfo[playerid][pAdmin] == 2) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: You need to be a Level Five Administrator to use this command!");

    if(PlayerInfo[playerid][pAdmin] == 3) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: You need to be a Level Five Administrator to use this command!");

    if(PlayerInfo[playerid][pAdmin] == 4) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: You need to be a Level Five Administrator to use this command!");
   
    if(PlayerInfo[playerid][pAdmin] >= 5)
    {
        if(sscanf(params, "ui", id, type)) return SendClientMessage(playerid, COLOR_GREY, "Correct Usage: /asetlevel [playerid] [level 0 - 5]");
        else
        {
            if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: This player is not connected to the server.");
            if(type < 0 || type > 5) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Cannot go below 0 or above 5");
            {
                PlayerInfo[id][pAdmin] = type;
                format(string, sizeof(string), "Admin %s (%d) has set %s (%d) level to %d", GetName(playerid), playerid, GetName(id), id, type);
                SendClientMessageToAll(COLOR_GREEN, string);
            }
        }
    }
    return 1;
}

COMMAND:asetadmin(playerid, params[])
{
    new string[128], id, type;
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Login to RCON to use command!");
    if(IsPlayerAdmin(playerid))
    {
        if(sscanf(params, "ui", id, type)) return SendClientMessage(playerid, COLOR_GREY, "Correct Usage: /asetadmin [playerid] [level 0 - 5]");
        else
        {
            if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: This player is not connected to the server.");
            if(type < 0 || type > 5) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Cannot go below 0 or above 5");
            {
                PlayerInfo[id][pAdmin] = type;
                format(string, sizeof(string), "RCON Admin has set %s (%d) level to %d", GetName(id), id, type);
                SendClientMessageToAll(COLOR_GREEN, string);
            }
        }
    }
    return 1;
}

COMMAND:arevokeadmin(playerid, params[])
{
    new string[128], id;
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Login to RCON to use command!");
    if(IsPlayerAdmin(playerid))
    {
        if(sscanf(params, "ui", id)) return SendClientMessage(playerid, COLOR_GREY, "Correct Usage: /arevokeadmin [playerid]");
        else
        {
            if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: This player is not connected to the server.");
            {
                PlayerInfo[id][pAdmin] = 0;
                SendClientMessage(id, COLOR_RED, "RCON Admin has revoked your Admin level");
            }
        }
    }
    return 1;
}
Let me know if any problems occur or you can private message me right here on the SA:MP forum. Glad I could help!
Kind regards,

Sean
Reply


Messages In This Thread
A plea for aid. - by SilencedPistol - 21.03.2013, 22:01
Re: A plea for aid. - by Chrillzen - 21.03.2013, 22:26
Re: A plea for aid. - by sniperwars - 21.03.2013, 22:33
Re: A plea for aid. - by P3DRO - 22.03.2013, 01:07
Re: A plea for aid. - by Chrillzen - 22.03.2013, 02:09

Forum Jump:


Users browsing this thread: 2 Guest(s)