Admin level problem.
#1

hi, anyways, i got my admin system working, saves the level and what not. but i have this ban command, and i made it so if the level isnt 2 they cant use it.
Код:
dcmd_ban(playerid, params[])
{
	if(PlayerInfo[playerid][AdminLevel] >= 2) return SendClientMessage(playerid, COLOR_RED, "Sorry, You need to be a level 2 or higher admin to use this command");
	new id, reason[64];
	if (sscanf(params, "uz", id, reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/ban <playerid/partname> <reason (optional)>\"");
	else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
	else
	{
		BanEx(id, reason);
		format(reason, sizeof (reason), "You have been banned%s%s.", reason[0] ? (" for: ") : (""), reason);
		SendClientMessage(id, 0xFF0000AA, reason);
		SendClientMessage(playerid, 0x00FF00AA, "Player banned");
	}
	return 1;}
but im level 3 on the server. and it says i cant use it... whats rong?
Reply
#2

Код:
dcmd_ban(playerid, params[])
{
	if(PlayerInfo[playerid][AdminLevel] <= 2) return SendClientMessage(playerid, COLOR_RED, "Sorry, You need to be a level 2 or higher admin to use this command");
	new id, reason[64];
	if (sscanf(params, "uz", id, reason)) SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/ban <playerid/partname> <reason (optional)>\"");
	else if (id == INVALID_PLAYER_ID) SendClientMessage(playerid, 0xFF0000AA, "Player not found");
	else
	{
		BanEx(id, reason);
		format(reason, sizeof (reason), "You have been banned%s%s.", reason[0] ? (" for: ") : (""), reason);
		SendClientMessage(id, 0xFF0000AA, reason);
		SendClientMessage(playerid, 0x00FF00AA, "Player banned");
	}
	return 1;
}
You put the condtion : PlayerInfo[playerid][AdminLevel] >= 2 , so if you are Admin level greater or equal to 2, then it will tell you need to be higher level. It should be less than or equal to. :P

Reply
#3

thanks it works. now this is my next.
Код:
dcmd_acmds(playerid, params[])
{
	#pragma unused params
	if(PlayerInfo[playerid][AdminLevel] == 1){
		SendClientMessage(playerid,COLOR_GREEN,"[SYSTEM-1]: /slap|/kick|");
		if(PlayerInfo[playerid][AdminLevel] == 2){
			SendClientMessage(playerid,COLOR_GREEN,"[SYSTEM-2]: /slap|kick|/ban|");
			if(PlayerInfo[playerid][AdminLevel] == 3){
				SendClientMessage(playerid,COLOR_GREEN,"[SYSTEM-3]: /slap|kick|/ban|/setadmin|");
	  	}
		}
	}
	return 1;
}
trying to show the commands available for their level, but when you type /acmds nothing happends.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)