Admin Commands Issue
#8

pawn Код:
CMD:makeadmin(playerid, params[])
{
    if(PlayerInfo[playerid][pAdminLevel] < 5) return SendClientMessage(playerid, COLOR_GREY, "You're not authorized to use that command");
    new PID, lvl;
    if(sscanf(params, "ui", PID, lvl)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /makeadmin [playerid] [Admin Level]");
    if(!IsPlayerConnected(PID)) return SendClientMessage(playerid, COLOR_RED, "Player is not connected!");
    new str[128], PName[MAX_PLAYER_NAME], AName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, AName, sizeof(AName));
    GetPlayerName(PID, PName, sizeof(PName));
    format(str, sizeof(str), "%s Has set %s admin level to %i ", AName, PName, lvl);
    foreach(Player, i) if(PlayerInfo[i][pAdminLevel] > 0) SendClientMessage(i,COLOR_YELLOW,str);
    PlayerInfo[PID][pAdminLevel] = lvl;
    return 1;
}
pawn Код:
CMD:a(playerid, params[])
{
    if(PlayerInfo[playerid][pAdminLevel] < 1) return SendClientMessage(playerid, COLOR_GREY, "You're not authorized to use this command");
    if(isnull(params)) return SendClientMessage(playerid, -1, "USAGE: /a [Text]");
    new str[128];
    format(str, sizeof(str), "[OOC] %s %s: %s", GetAdminName(playerid), GetName(playerid), params);
    foreach(Player, i) if(PlayerInfo[i][pAdminLevel] > 0) SendClientMessage(i,COLOR_YELLOW,str);
    return 1;
}
pawn Код:
stock GetAdminName(playerid)
{
    new name[25];
    switch(PlayerInfo[playerid][pAdminLevel])
    {
        case 1: name = "Trial Admin";
        case 2: name = "Junior Admin";
        case 3: name = "General Admin";
        case 4: name = "Senior Admin";
        case 5: name = "Head Admin";
        case 100: name = "Co-Community Director";
        case 102: name = "Community Director";
    }
    return name;
}
Reply


Messages In This Thread
Admin Commands Issue - by Cole_William - 18.07.2014, 16:48
Re: Admin Commands Issue - by Blademaster680 - 18.07.2014, 16:51
Re: Admin Commands Issue - by Cole_William - 18.07.2014, 16:54
Re: Admin Commands Issue - by Clad - 18.07.2014, 16:55
Re: Admin Commands Issue - by Cole_William - 18.07.2014, 16:59
Re: Admin Commands Issue - by Dignity - 18.07.2014, 16:59
Re: Admin Commands Issue - by Clad - 18.07.2014, 17:02
Re: Admin Commands Issue - by Konstantinos - 18.07.2014, 17:04
Re: Admin Commands Issue - by Cole_William - 18.07.2014, 17:07
Re: Admin Commands Issue - by Clad - 18.07.2014, 17:13

Forum Jump:


Users browsing this thread: 1 Guest(s)