27.07.2017, 00:18
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:
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;
}