makeAdmin Command urgent
#2

pawn Код:
CMD:makeadmin(playerid, params[])
{
    new admlvl, id, string[128], output[48];
    if (P_DATA[playerid][pAdmin] < 6) return SendClientMessage(playerid, ERRORCOL, "You need to be admin to use this command!");
    if(sscanf(params, "ui", id, admlvl)) return SendClientMessage(playerid, ERRORCOL, "SYNTAX: /makeadmin [id] [adminlevel]");
    if(id == INVALID_PLAYER_ID) return SendClientMessage(playerid, ERRORCOL, "This player is not connected");
    if(admlvl > 6 || admlvl < 0) return SendClientMessage(playerid, ERRORCOL,"Admin levels reach from '0' to '6'");
    {
        switch(admlvl)
        {
            case 1: output = "a Probationary Admin";
            case 2: output = "a General Admin";
            case 3: output = "a Senior Admin";
            case 4: output = "a Server Manager";
            case 5: output = "an Executive Admin";
            case 6: output = "a 'ur rank here'";
            default: output = "an Undefined Admin";
        }
        if(P_DATA[id][pAdmin] != admlvl)
        {
            if(admlvl < P_DATA[id][pAdmin])
            {
                format(string, sizeof(string),"You have been demoted to %s by %s", output ,GetPlayerNameEx(playerid));
            }
            if(admlvl > P_DATA[id][pAdmin])
            {
                format(string, sizeof(string),"You have been promoted to %s by %s", output ,GetPlayerNameEx(playerid));
            }
            if(admlvl == 0)
            {
                format(string, sizeof(string),"You have been fired from the administration team by %s", GetPlayerNameEx(playerid));
            }
            P_DATA[id][pAdmin] = admlvl;
            SendClientMessage(id, 0xFF0000FF, string);
        }
        else SendClientMessage(playerid, 0xFFFFFFFF, "User already has that admin level");
    }
    return 1;
}


stock GetPlayerNameEx(playerid)
{
    new name[24];
    GetPlayerName(playerid, name, sizeof(name));
    strreplace(name, '_', ' ');
    return name;
}
This is the makeadmin in my script, you can edit it how you like. I filled in the P_DATA ect for you.
Reply


Messages In This Thread
makeAdmin Command urgent - by Mriss - 07.03.2014, 22:04
Re: makeAdmin Command urgent - by ConnorHunter - 07.03.2014, 22:12
Re: makeAdmin Command urgent - by Mriss - 07.03.2014, 22:13
Re: makeAdmin Command urgent - by ConnorHunter - 07.03.2014, 22:16
Re: makeAdmin Command urgent - by Mriss - 07.03.2014, 22:19
Re: makeAdmin Command urgent - by ConnorHunter - 07.03.2014, 22:19
Re: makeAdmin Command urgent - by Mriss - 07.03.2014, 22:22
Re: makeAdmin Command urgent - by ConnorHunter - 07.03.2014, 22:24
Re: makeAdmin Command urgent - by Mriss - 07.03.2014, 22:26
Re: makeAdmin Command urgent - by ConnorHunter - 07.03.2014, 22:26

Forum Jump:


Users browsing this thread: 2 Guest(s)