Moveable Gates HELP
#1

Hey guys.
I know how to make moving gates. The deal is i want to make it in one command like /gate and first time it open the second time get closed. I know only with different commands like /gateopen | /gateclose.
Can anyone drop a look at this?
I want to make it in one command.

Код:
new Area51Gate; // on top

Area51Gate = CreateObject(988, 96.800003051758, 1920.4000244141, 17.299999237061, 0, 0, 268.5); //ongamemodeinit

	if (strcmp("/agateopen", cmdtext, true, 10) == 0)
	{
 	if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not authorised to use that command.");
        MoveObject(Area51Gate, 96.800003051758, 1920.4000244141, 13, 3);
	return 1;
        }

	if (strcmp("/agateclose", cmdtext, true, 10) == 0)
	{
 	if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not authorised to use that command.");
	MoveObject(Area51Gate, 96.800003051758, 1920.4000244141, 17.299999237061, 3);
	return 1;
	}
+REP for the dude who help me to deal with that.
Reply
#2

hello!

you can do it like this:

Код:
new bool:OpenGate;
new Area51Gate; // on top

Area51Gate = CreateObject(988, 96.800003051758, 1920.4000244141, 17.299999237061, 0, 0, 268.5); //ongamemodeinit

OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/MoveGate",true))
    { 
         if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not authorised to use that command.");
         if(!OpenGate)
         {
                     OpenGate = true;
                     MoveObject(Area51Gate, 96.800003051758, 1920.4000244141, 13, 3); 
         }   
         else
         {
                   OpenGate = false;
                   MoveObject(Area51Gate, 96.800003051758, 1920.4000244141, 17.299999237061, 3);   
         }
         return 1;
    }
}
Reply
#3

Thanks, that was simple and fast.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)