CMD:kick(playerid, params[])
{
new id, reason;
if (AccountInfo[playerid][AdminLevel] < 0) SendClientMessage(playerid, COLOR_RED, "Error ~ You are not an administrator with the required level");
else if (sscanf(params, "uz", id, reason)) SendClientMessage(playerid, COLOR_RED, "Usage ~ /kick [PlayerID/PartOfName] [Reason]");
else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, COLOR_RED, "Error ~ Player not Connected");
else if (AccountInfo[id][AdminLevel] > 5) SendClientMessage(playerid, COLOR_RED, "Error ~ You cannot kick the highest level admin");
else
{
new string[128];
new sendername[MAX_PLAYER_NAME];
new targetname[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof sendername);
GetPlayerName(playerid, targetname, sizeof targetname);
format(string, sizeof string, "Administrator %s has kicked you from the server, Reason: %s", sendername, reason);
SendClientMessage(id, COLOR_BLUE, string);
format(string, sizeof string, "You have kicked player %s, Reason: %s", targetname, reason);
SendClientMessage(playerid, COLOR_BLUE, string);
Kick(playerid);
}
return 1;
}
else if (AccountInfo[id][AdminLevel] > 5) SendClientMessage(playerid, COLOR_RED, "Error ~ You cannot kick the highest level admin");
else if (AccountInfo[id][AdminLevel] > 5 || IsPlayerAdmin(id)) SendClientMessage(playerid, COLOR_RED, "Error ~ You cannot kick the highest level admin");
Originally Posted by Carlton
You should use the || which means or, so the old code you have put in was:
Код:
else if (AccountInfo[id][AdminLevel] > 5) SendClientMessage(playerid, COLOR_RED, "Error ~ You cannot kick the highest level admin"); Код:
else if (AccountInfo[id][AdminLevel] > 5 || IsPlayerAdmin(id)) SendClientMessage(playerid, COLOR_RED, "Error ~ You cannot kick the highest level admin"); > - Left is greater than right < - Left is less than right So re-read your statement: If(ThePlayer'sAdminLevel is greater than 5). That will mean if the player is higher than the lead admin can't kick them. So that will lead other admins to kick the high level admin, change > to < |