Setting admins
#7

This is how it was earlier before I changed the make admin command and the admin rank names and it worked perfectly.

pawn Код:
COMMAND:makeadmin(playerid, params[])
{
    new targetid, alevel, str[128];
    if(PlayerStat[playerid][AdminLevel] < 5) return SendClientMessage(playerid, GREY, "You can't use this command.");
    if(sscanf(params,"ud", targetid, alevel))return SendClientMessage(playerid, GREY, "USAGE: /makeadmin [playerid] [adminlevel]");
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, GREY, "Target ID not found.");
    if(alevel < 0) return SendClientMessage(playerid, GREY, "Invalid admin level.");
    if(PlayerStat[targetid][AdminLevel] <= alevel)
    {
        format(str, sizeof(str), "Admin %s has promoted %s to level %d admin.", GetOOCName(playerid), GetOOCName(targetid), alevel);
        SendClientMessageToAll(RED, str);
        AdminActionLog(str);
        PlayerStat[targetid][AdminLevel] = alevel;
    }
    if(PlayerStat[targetid][AdminLevel] > alevel)
    {
        format(str, sizeof(str), "Admin %s has demoted %s to level %d admin.", GetOOCName(playerid), GetOOCName(targetid), alevel);
        SendClientMessageToAll(RED, str);
        AdminActionLog(str);
        PlayerStat[targetid][AdminLevel] = alevel;
    }
    return 1;
}
pawn Код:
stock GetAdminRank(playerid)
{
    new Rank[60];
    if(PlayerStat[playerid][AdminLevel] >= 1)
    {
        if(PlayerStat[playerid][AdminLevel] == 1) format(Rank, sizeof(Rank), "Moderator");
        if(PlayerStat[playerid][AdminLevel] == 2) format(Rank, sizeof(Rank), "Administrator");
        if(PlayerStat[playerid][AdminLevel] == 3) format(Rank, sizeof(Rank), "Administrator");
        if(PlayerStat[playerid][AdminLevel] == 4) format(Rank, sizeof(Rank), "Head Administrator");
        if(PlayerStat[playerid][AdminLevel] == 5) format(Rank, sizeof(Rank), "Management");
        if(PlayerStat[playerid][AdminLevel] == 1338) format(Rank, sizeof(Rank), "Management");
    }
    else
    {
        Rank = "None";
    }
    return Rank;
}
Reply


Messages In This Thread
Setting admins - by Josh_Main - 01.10.2014, 10:10
Re: Setting admins - by amirab - 01.10.2014, 10:20
Re: Setting admins - by Josh_Main - 01.10.2014, 10:26
Re: Setting admins - by ReD_HunTeR - 01.10.2014, 10:29
Re: Setting admins - by Josh_Main - 01.10.2014, 10:35
Re: Setting admins - by thefatshizms - 01.10.2014, 10:37
Re: Setting admins - by Josh_Main - 01.10.2014, 10:38
Re: Setting admins - by MillenniumG - 01.10.2014, 11:12
Re: Setting admins - by Josh_Main - 01.10.2014, 11:44
Re: Setting admins - by MillenniumG - 01.10.2014, 12:59

Forum Jump:


Users browsing this thread: 1 Guest(s)