SA-MP Forums Archive
SCRIPT HELP! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SCRIPT HELP! (/showthread.php?tid=509238)



SCRIPT HELP! - spykidz01 - 26.04.2014

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;
}



Re : SCRIPT HELP! - S4t3K - 26.04.2014

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.