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
#2

someone help me??
Reply
#3

I need it ?
Reply
#4

pawn Код:
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);
You are creating two gates with the same name. Rename the second gate as something like gate2, and in the GateCheck function, add another line for the gate2. (the MoveObject one)
Reply
#5

Quote:
Originally Posted by Rajat_Pawar
Посмотреть сообщение
pawn Код:
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);
You are creating two gates with the same name. Rename the second gate as something like gate2, and in the GateCheck function, add another line for the gate2. (the MoveObject one)
thanx but can u tell me on 2nd script moving script?
Reply
#6

if i put gate2 i got alot error and btw when i put like this gate = i got no error and i got 2 gates but moving problem
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)