Define function help ...
#1

Hi, i make a function to verify if a player is Admin or V.I.P to use respective command.

Here is the code:
Код:
#define VACheck(%0,%1,%2)\
		do{\
	   		if(PlayerInfo[(%0)][pVip] < (%1) || PlayerInfo[(%0)][Level] < (%2)){\
    			new Str[128];\
    			format(Str, 128, "~r~~h~ERROR!~n~~w~You need to be V.I.P level ~y~~h~%d ~w~ or admin level ~y~~h~%d ~w~to use this command!", (%1), (%2));\
				return GameTextForPlayer((%0), Str, 3000, 4);\
			}\
		}\
		while(False)
Ok ... and i use:
Код:
CMD:god( playerid, params[ ] )
{
    VACheck( playerid, 4, 4 );
    SendClientMessage( playerid, 0xFFFFF, "Testing" );
    return 1;
}
If i have V.I.P level 4 and Admin level 4 or highest, the command will execute, but if i have Admin level 10, and V.I.P level 0, the command don't execute, and gave me: "ERROR You need to be ..."

What is the problem?
Reply


Messages In This Thread
Define function help ... - by Edvin - 10.05.2012, 13:37
Re: Define function help ... - by Edvin - 10.05.2012, 15:22
Re: Define function help ... - by Disturn - 10.05.2012, 16:09

Forum Jump:


Users browsing this thread: 2 Guest(s)