Moveing Problem
#1

i was creat 1 gate but they work and fine but when i create 2 they dnt work on moving

there is code

Код:
    SetTimer("GateCheck", 800, true); //This is used to create the timer. The "GateCheck" is the callback we'll be using,
    // the '800' is the amount of milliseconds between each call and the 'true' indicates that this timer is looping endlessly
    gate = CreateObject(971, 2335.18, 2443.37, 7.06,   0.00, 0.00, 60.00);
    gate = CreateObject(971, 2293.95, 2499.35, 4.28,   0.00, 0.00, 90.00);
    //'gate = CreateObject(...);' = Assigns the object id of the gate to the 'gate' variable
    //978 = object model id < change it to the model id you use for your gate
    // 8.0, 3.0, 10.0 = coordinates of the gate
    // 0.0, 0.0, 0.0 = Rotation of the gate. None in this case.
Код:
forward GateCheck();
public GateCheck()
{
  for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        
    if(IsPlayerInRangeOfPoint(i, 10.0, 2335.18, 2443.37, 7.06))//Check if any player is in the area. Replace '8.0, 3.0, 10.0' with your own coordinates of your closed gate.
	if(IsPlayerInRangeOfPoint(i, 10.0,  2293.95, 2499.35, 4.28))//Check if any player is in the area. Replace '8.0, 3.0, 10.0' with your own coordinates of your closed gate.
    {
      if(gateopen == false) // If the gate isn't open...
      {
      MoveObject(gate, 2335.18, 2443.37, -5.00, 2.5); //Then open it! Change '32.0, 12.0, 10.0' to the coordinates of your opened gate.
	  gateopen = true; // Setting this to true indicates it's open(ing)
	  
	  MoveObject(gate, 10.0,  2293.95, 2499.35, 4.28, 2.5); //Then open it! Change '32.0, 12.0, 10.0' to the coordinates of your opened gate.
	  gateopen = true; // Setting this to true indicates it's open(ing)
      }
      return; //This closes the callback
    }
  }
  //This is called if nobody has been found near the gate. Obviously, because 'return' would fully close the function and this wouldn't be used then.
  if(gateopen == true) //If the gate IS open, but there's no one near..
  {
    MoveObject(gate, 2335.18, 2443.37, 7.06, 2.5);// Change the '8.0, 3.0, 10.0' to the coordinates of your gate when it's closed.
    gateopen = false; //This indicates the gate is closed again. Or at least, closing.
    
    MoveObject(gate, 2293.95, 2499.35, 4.28, 2.5); // Change the '8.0, 3.0, 10.0' to the coordinates of your gate when it's closed.
    gateopen = false; //This indicates the gate is closed again. Or at least, closing.
  }
}
Reply


Messages In This Thread
Moveing Problem - by sscarface - 06.01.2013, 12:40
Re: Moveing Problem - by sscarface - 06.01.2013, 12:48
Re: Moveing Problem - by sscarface - 06.01.2013, 12:56
Re: Moveing Problem - by RajatPawar - 06.01.2013, 13:16
Re: Moveing Problem - by sscarface - 06.01.2013, 13:24
Re: Moveing Problem - by sscarface - 06.01.2013, 13:29

Forum Jump:


Users browsing this thread: 1 Guest(s)