SCRIPT HELP!
#1

How i can make a command for admins only? Because i have a command which is /opengate and /closegate that is in the admin base gate, and only only admins must be can open it, but i try to log in with different name (ordinary player) in my server and do the command /opengate and /closegate and it works! I need help how to fixed this cmd to be for admin use only!!!

Код:
}
public OnPlayerCommandText(playerid, cmdtext[])
{
	if(!strcmp(cmdtext, "/opengate", true, 14))
	{
  	MoveObject(aGate, 2920.35253906,-796.28979492,04.04159927, 3.0);
   	SendClientMessage(playerid, 0xEF994300, "The Gate Has Been Opened!");
   	return 1;
	}

	if(!strcmp(cmdtext, "/closegate", true, 16))
	{
    MoveObject(aGate, 2920.35253906,-796.28979492,10.04159927, 3.0);
    SendClientMessage(playerid, 0xEF994300, "The Gate Has Been Closed!");
	return 1;
	}
	return 0;
}
Reply
#2

Lol.

Are we supposed to guess your admin's variable name ?

Simply add just before the MoveObject line a condition which checks if the admin variable value for playerid is superior or equal to 1.
If it is not, return 0;
If it is, make the door mooving.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)