Cant Ban Admin.
#1

hi how can I make so admins cant ban them.. only isplayeradmin can ban them!plz help.
Reply
#2

if its ur enum pInfo then
pawn Код:
if(pInfo[playerid][Admin] < pInfo[id][Admin]) return SendClientMessage(playerid, COLOR_RED,"You cannot use this command on higher admin!");
Reply
#3

I want only isplayeradmin to ban..

I don't want admins to ban them selves only isplayeradmin.
Reply
#4

Make a check to see if the user trying to ban the player is an RCON administrator?
Reply
#5

You answered your own question.

pawn Код:
if(IsPlayerAdmin(changethistoyourTARGETvariable)) return 0;

Here I'll make you a quick CMD.

pawn Код:
CMD:ban(playerid,params[])
{
    if(IsPlayerAdmin(playerid))
    {
        new target;
        if(sscanf(params,"u",target)) return SendClientMessage(playerid,-1,"/ban id/partofname"); // Checking if the TARGET is a valid player.
        if(!IsPlayerConnected(target)) return 0; // If the target isn't online this command will stop.
        if(IsPlayerAdmin(target)) return SendClientMessage(playerid,-1,"You can't ban an RCON administrator."); // If the entered ID is an RCON logged in admin you can't ban him.
        if(target == playerid) return SendClientMessage(playerid,-1,"You can't ban yourself.");
        Ban(target);
    }
}
If I am missed something I am sorry as I said it's a quick CMD.
Reply
#6

pawn Код:
if(PlayerInfo[targetid][pAdmin] && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Only RCON Administrators can ban other Administrators.");
Where 'PlayerInfo[targetid][pAdmin]' is replaced with your own admin variable for the targeted player.
Reply
#7

Quote:
Originally Posted by Threshold
Посмотреть сообщение
pawn Код:
if(PlayerInfo[targetid][pAdmin] && !IsPlayerAdmin(playerid)) return SendClientMessage(playerid, -1, "Only RCON Administrators can ban other Administrators.");
Where 'PlayerInfo[targetid][pAdmin]' is replaced with your own admin variable for the targeted player.
ok and how can I make it so only "ALEX" can ban admins. and others cant ban them selves??instead of !isplayeradmin
Reply
#8

fixed. sorry
Reply
#9

Use STRCMP for that:

pawn Код:
if(!strcmp(ReturnName(playerid), "ALEX", false))
Any feedback would be appreciated
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)