Admin command
#2

pawn Code:
CMD:setadmin(playerid, params[])
{
    if(!IsPlayerAdmin(playerid))return 0;
    if(sscanf(params,"ui",ID,levels)) return SendClientMessage(playerid,0xFF9900AA, "-USAGE- /setadmin [ID] [Level 1-5]");
    if(levels > 5) return SendClientMessage(playerid,0xFF0000FF,"LEVELS AVAILABLE 1-5!");
    if(!IsPlayerConnected(ID))return SendClientMessage(playerid,COLOR_RED,"That user is not connected.");
    if(PlayerData[ID][AdminLevel] == levels) return SendClientMessage(playerid,0xFF0000FF, "ERROR: That person is already this admin level!");
    GetPlayerName(playerid,Nam, MAX_PLAYER_NAME);
    GetPlayerName(ID,pname,MAX_PLAYER_NAME);
    if(levels == 0)
    {
        format(str, sizeof(str),"%s has set your Admin level to %d",Nam,levels);
        SendClientMessage(ID,0xFF9900AA,str);
        format(str, sizeof(str),"You had set %s Admin level to %d!",pname,levels);
        SendClientMessage(playerid,0xFF9900AA,str);
        PlayerData[ID][AdminLevel] = levels;
        return 1;
    }
    format(str, sizeof(str),"%s has set your Admin level to %d on the server.",Nam,levels);
    SendClientMessage(ID,0xFF9900AA,str);
    format(str, sizeof(str),"You had set %s Admin level to %d!",pname,levels);
    SendClientMessage(playerid,0xFF9900AA,str);
    PlayerData[ID][AdminLevel] = levels;
    return 1;
You gotta use your enum here is an example

pawn Code:
if(pAdmin[playerid] >= 1)
Show me your enum script and I'll convert your /setadmin to it instead of using the RCON admin

BTW Your Enum is the PlayerInfo where you can all the player info for example; passwords, locations and ect...
Reply


Messages In This Thread
Admin command - by RieTzz - 05.06.2012, 16:02
Re: Admin command - by ViruZz - 05.06.2012, 16:11
Re: Admin command - by RieTzz - 05.06.2012, 16:16
Re: Admin command - by ViruZz - 05.06.2012, 16:22
Re: Admin command - by RieTzz - 05.06.2012, 16:25
Re: Admin command - by ViruZz - 05.06.2012, 16:27
Re: Admin command - by RieTzz - 05.06.2012, 16:29
Re: Admin command - by ViruZz - 05.06.2012, 16:31
Re: Admin command - by RieTzz - 05.06.2012, 16:32
Re: Admin command - by RieTzz - 05.06.2012, 18:39
Re: Admin command - by HuSs3n - 06.06.2012, 11:51
Re: Admin command - by MadeMan - 06.06.2012, 12:20

Forum Jump:


Users browsing this thread: 1 Guest(s)