Macro - Code after body
#1

Hi,

I'm using zcmd for the player commands in my script.
Now I want to add some admin commands. In every script I have to check if the player has the required permission.
Currently I'm doing it this way:

Код:
CMD:makeadmin(playerid, params[])
{
	if (IsAdmin(playerid, PERMISSION_COMMAND_MAKEADMIN))
	{
		// Some code executed if the player has the permission
	}
	else
	{
		return COMMAND_PERMISSION_DENIED;
	}
}
That's unsafe because I can forget to add the IsAdmin check.

So I want to convert this code into a macro. I want to use something like this to write my admin commands:
Код:
ACMD:makeadmin(playerid, params[])
{
	// Some code executed if the player has the permission
}
IsAdmin should be called in the macro and use the constant "PERMISSION_COMMAND_{command}" as the second parameter.

Is that possible?
Reply


Messages In This Thread
Macro - Code after body - by Programie - 20.02.2012, 13:53
Re: Macro - Code after body - by MP2 - 20.02.2012, 13:55
Re: Macro - Code after body - by Programie - 20.02.2012, 13:56
Re: Macro - Code after body - by Cameltoe - 20.02.2012, 14:02
Re: Macro - Code after body - by Programie - 20.02.2012, 14:04
Re: Macro - Code after body - by Programie - 20.02.2012, 14:44
Re: Macro - Code after body - by Programie - 20.02.2012, 16:34
Re: Macro - Code after body - by Programie - 20.02.2012, 16:47

Forum Jump:


Users browsing this thread: 1 Guest(s)