Pawn.CMD icon indicating copy to clipboard operation
Pawn.CMD copied to clipboard

Problem whit flags

Open Walter-Correa opened this issue 1 year ago • 0 comments

I'm trying to create flags based on admin level, but it's not working!

I wanted to prevent admins below level 3 from using /test command:

new CMD_ADM_1 = 1
new CMD_ADM_2 = 2
new CMD_ADM_3 = 3
new CMD_ADM_4 = 4
new CMD_ADM_5 = 5
new CMD_ADM_6 = 6

new PlayerCmdAdmin[MAX_PLAYERS];

PlayerCmdAdmin[playerid] = CMD_ADM_2;

flags:test(CMD_ADM_3 | CMD_ADM_4 | CMD_ADM_5 | CMD_ADM_6)
CMD:test(playerid)
{
	return 1;
}

public OnPlayerCommandReceived(playerid, cmd[], params[], flags)
{
	if(flags && !(flags & PlayerCmdAdmin[playerid]))
	{
		SendClientMessage(playerid,-1,"Not allowed!");
		return 0;
	}
	return 1;
}

Walter-Correa avatar Aug 20 '22 17:08 Walter-Correa