Need help with admin immunity - 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: Need help with admin immunity (
/showthread.php?tid=638114)
Need help with admin immunity -
baki - 27.07.2017
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(playerid, params[])
{
// Check is player an admin
if(GetPVarInt(playerid, "PlayerAdminLevel") < 3)
{
// Send message and exit
SendClientMessage(playerid, COLOR_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]", lookupid, reason))
{
// Send messages and exit
SendClientMessage(playerid, COLOR_RED, "** Usage: /ban <PlayerID/PlayerName> <Reason>");
SendClientMessage(playerid, COLOR_RED, "* It will ban player from the server.");
SendClientMessage(playerid, COLOR_RED, "* Player will NOT be able to rejoin.");
return 1;
}
// Check is player connected
if(!IsPlayerConnected(lookupid))
{
// Send message and exit
SendClientMessage(playerid, COLOR_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(pname, lookupid, reason);
// Exit here
return 1;
}
Re: Need help with admin immunity -
Amit1998 - 27.07.2017
PHP код:
if(GetPVarInt(playerid, "PlayerAdminLevel") < GetPVarInt(lookupid, "PlayerAdminLevel"))
{
SendClientMessage(playerid, -1, "You cannot ban this player!");
return 1;
}
Re: Need help with admin immunity -
baki - 27.07.2017
Yo thanks i just figured it out haha