Need help with admin immunity
#1

I want my ban command to have admin immunity cause lower level admins can ban higher lvs i am a newbie with this so can you guys help me?
here is the code:

PHP код:
COMMAND:ban(playeridparams[])
{
    
// Check is player an admin
    
if(GetPVarInt(playerid"PlayerAdminLevel") < 3)
    {
        
// Send message and exit
        
SendClientMessage(playeridCOLOR_RED"* Sorry, only level 3 and higher admins can use the ban command.");
        return 
1;
    }
    
// Create variable
    
new
        
lookupid,
        
reason[64];
    
// Check did admin enter player ID
    
if(sscanf(params"us[64]"lookupidreason))
    {
        
// Send messages and exit
        
SendClientMessage(playeridCOLOR_RED"** Usage: /ban <PlayerID/PlayerName> <Reason>");
        
SendClientMessage(playeridCOLOR_RED"*  It will ban player from the server.");
        
SendClientMessage(playeridCOLOR_RED"*  Player will NOT be able to rejoin.");
        return 
1;
    }
    
// Check is player connected
    
if(!IsPlayerConnected(lookupid))
    {
        
// Send message and exit
        
SendClientMessage(playeridCOLOR_RED"* The player you want to ban is not connected.");
        return 
1;
    }
     
// Create variables
    
new
        
pname[24],
        
xname[24];
    
// Get players names
    
GetPlayerName(playerid,pname,sizeof(pname));
    
GetPlayerName(lookupid,xname,sizeof(xname));
/*
    // If admin entered id from himself or other admin
    if (GetPVarInt(lookupid, "PlayerAdminLevel") > 0)
    {
        // Send message to admin
        SendClientMessage(playerid, COLOR_RED, "* You can't use this command on an admin.");
        return 1;
    }*/
    // Process ban
    
BanPlayer(pnamelookupidreason);
    
// Exit here
    
return 1;

Reply
#2

PHP код:
if(GetPVarInt(playerid"PlayerAdminLevel") < GetPVarInt(lookupid"PlayerAdminLevel"))
{
SendClientMessage(playerid, -1"You cannot ban this player!");
return 
1;

Reply
#3

Yo thanks i just figured it out haha
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)