SA-MP Forums Archive
Cant Ban Admin. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Cant Ban Admin. (/showthread.php?tid=528330)



Cant Ban Admin. - Akcent_Voltaj - 27.07.2014

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


Re: Cant Ban Admin. - SHE790 - 27.07.2014

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!");



Re: Cant Ban Admin. - Akcent_Voltaj - 27.07.2014

I want only isplayeradmin to ban..

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


Re: Cant Ban Admin. - sammp - 27.07.2014

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


Re: Cant Ban Admin. - Beckett - 27.07.2014

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.


Re: Cant Ban Admin. - Threshold - 27.07.2014

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.


Re: Cant Ban Admin. - Akcent_Voltaj - 31.07.2014

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


Re: Cant Ban Admin. - Akcent_Voltaj - 31.07.2014

fixed. sorry


Re: Cant Ban Admin. - Stanford - 31.07.2014

Use STRCMP for that:

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