AutoGates - Howto?
#6

Код:
new GatePos; //Checks if the gate is open or closed ((Add this to the top of your code))
new AreaTimer; //Variable assigned to the Area timer ((Add this to the top of your code))
forward Area(playerid); //Script initiated for the timer ((Add this to the top of your code))

GatePos = 0; //((Add this part to the OnGameModeInit))

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/secret", cmdtext, true, 10) == 0)
	{
		if(GatePos==0)
		{
		  if(PlayerToPoint(15.0, playerid, -2468.3889, 1547.0945, 23.8359))
  		{
     		MoveObject(cozgate, -2468.371338, 1547.240723, 24.030167, 2.0);
     		GatePos=1;
     		AreaTimer=SetTimerEx("Area",1,true,"d",playerid);
    	}
    	else
    	{
    	  SendClientMessage(playerid,0xFFFF00AA,"You are not near the gate!");
    	}
		}
		else
		{
		  if(PlayerToPoint(15.0, playerid, -2468.3889, 1547.0945, 23.8359))
  		{
     		MoveObject(cozgate, -2468.352051, 1547.224243, 21.280209, 2.0);
				GatePos=0;
     		KillTimer(AreaTimer);
    	}
    	else
    	{
    	  SendClientMessage(playerid,0xFFFF00AA,"You are not near the gate!");
    	}
		}
		return 1;
	}
	return 0;
}

public Area(playerid)
{
  if(PlayerToPoint(15.0, playerid, -2468.3889, 1547.0945, 23.8359))
  {
  }
	else
	{
	  MoveObject(cozgate, -2468.352051, 1547.224243, 21.280209, 2.0);
	  GatePos=0;
	  KillTimer(AreaTimer);
	}
	return 1;
}
This should work. If it doesn't, feel free to ask for help.

EDIT: I added some coding so if you haven't copied it recently, replace all the code in public OnPlayerCommandText and public Area(playerid).
Reply


Messages In This Thread
AutoGates - Howto? - by cozza123456 - 18.08.2009, 12:27
Re: AutoGates - Howto? - by Hei2 - 18.08.2009, 17:31
Re: AutoGates - Howto? - by _Vortex - 18.08.2009, 17:32
Re: AutoGates - Howto? - by cozza123456 - 18.08.2009, 17:37
Re: AutoGates - Howto? - by Takumi.WS - 18.08.2009, 17:42
Re: AutoGates - Howto? - by Hei2 - 18.08.2009, 17:51
Re: AutoGates - Howto? - by cozza123456 - 18.08.2009, 18:05
Re: AutoGates - Howto? - by Hei2 - 18.08.2009, 18:10
Re: AutoGates - Howto? - by cozza123456 - 18.08.2009, 18:18
Re: AutoGates - Howto? - by Hei2 - 18.08.2009, 18:19

Forum Jump:


Users browsing this thread: 1 Guest(s)