How to create admin levels
#4

Quote:
Originally Posted by nilanjay
View Post
I am making an admin script but i don't know how to make admin lvls correcttly so please tell me.
Well to start it off, do you have a Login and register system?

The base of making the Admin Levels is actually in the command, /Setadmin,/Makeadmin, /Setlevel.

I don't have much information about your script yet so i will show you a Makeadmin command.

pawn Code:
CMD:setadmin(playerid, params[])
{
    new victimname[MAX_PLAYER_NAME], adminname[MAX_PLAYER_NAME], admlvl, id;
    if(IsPlayerAdmin(playerid))
    {
        if (sscanf(params, "ui", id, admlvl)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /setadmin [id] [adminlevel]");
        if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "System: Invalid ID");
        if (admlvl > 10 || admlvl < 0) return SendClientMessage(playerid, COLOR_RED,"System: Valid Admin Levels: 1-10!");
        PlayerInfo[id][pAdminLevel] = admlvl;
        GetPlayerName(id, victimname, sizeof(victimname));
        GetPlayerName(playerid, adminname, sizeof(adminname));
        new str[128];
        format(str,128,"System: %s [ID %d] has set %s [ID %d] admin level to %i",adminname, playerid, victimname, id, admlvl);
        SendClientMessage(playerid,COLOR_GREEN,str);
        return 1;
    }
    else return SendClientMessage(playerid,COLOR_RED,"  You are not allowed to use this command!");
}
Make sure you have you pAdminLevel in Enums

Then the base of your code would be

pawn Code:
if(PlayerInfo[playerid][pAdminLevel] >=1)
So for an example.

pawn Code:
CMD:jetpack(playerid,params[])
{
    if(PlayerInfo[playerid][pAdminLevel] >=3)
    {
        SetPlayerSpecialAction(playerid, 2);
        SendClientMessage(playerid,COLOR_GREEN, "|__Jetpack Spawned__|");
        return 1;
        }
        else return SendClientMessage(playerid, COLOR_RED, " You are not allowed to use this command");
    }
Only Admin's can use Jetpack command.
Reply


Messages In This Thread
How to create admin levels - by nilanjay - 02.08.2011, 16:57
Re: How to create admin levels - by Calgon - 02.08.2011, 16:59
Re: How to create admin levels - by nilanjay - 02.08.2011, 17:01
Re: How to create admin levels - by Shockey HD - 02.08.2011, 17:02
Re: How to create admin levels - by nilanjay - 02.08.2011, 17:03
Re: How to create admin levels - by Calgon - 02.08.2011, 17:03
Re: How to create admin levels - by nilanjay - 02.08.2011, 17:06
Re: How to create admin levels - by Shockey HD - 02.08.2011, 17:10
Re: How to create admin levels - by nilanjay - 02.08.2011, 17:10
Re: How to create admin levels - by nilanjay - 02.08.2011, 17:13
Re: How to create admin levels - by Calgon - 02.08.2011, 17:15
Re: How to create admin levels - by Tigerkiller - 02.08.2011, 17:16
Re: How to create admin levels - by Shockey HD - 02.08.2011, 17:16
Re: How to create admin levels - by Tigerkiller - 02.08.2011, 17:19
Re: How to create admin levels - by nilanjay - 02.08.2011, 17:20
Re: How to create admin levels - by Tigerkiller - 02.08.2011, 17:22
Re: How to create admin levels - by nilanjay - 02.08.2011, 17:38
Re: How to create admin levels - by Tigerkiller - 02.08.2011, 18:56

Forum Jump:


Users browsing this thread: 8 Guest(s)