20.06.2015, 10:47
Hi, I don't know why gate3 isn't moving. But gate and gate2 is working fine. Idk why gate3 isn't working. ANyone help. Thanks!
PHP код:
new gate;
new gate2;
new gate3;
new bool:gateopen;
SetTimer("GateCheck", 800, true); //This is used to create the timer. The "GateCheck" is the callback we'll be using,
gate = CreateObject(971, -1635.6461,688.7094,7.1875, 0.00, 0.00, 00.00);
gate2 = CreateObject(971, -1626.8461,688.7094,7.1875, 0.00, 0.00, 00.00);
gate3 = CreateObject(971, -2593.5501,1354.8292,7.0391, -1.00, -1.00, 48.00);
CreateObject(19870, -1621.8461,688.7094,7.1875, 0.00, 0.00, 00.00);
public GateCheck()
{
for(new i; i < MAX_PLAYERS; i++) // Start the loop
{
if(!IsPlayerConnected(i)) continue;
if(gTeam[i] == COPS || gTeam[i] == ARMY || gTeam[i] == FBI || gTeam[i] == CIA)
{
if(IsPlayerInRangeOfPoint(i, 10.0, -1630.6461,688.7094,7.1875)) //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, -1635.6461,688.7094,-2.1875, 2.5); //Then open it! Change '32.0, 12.0, 10.0' to the coordinates of your opened gate.
MoveObject(gate2, -1626.8461,688.7094,-2.1875, 2.5);
MoveObject(gate3, -2493.5501,1354.8292,-7.0391, 2.5, -1.00, -1.00, 48.00);
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, -1635.6461,688.7094,7.1875, 2.5); // Change the '8.0, 3.0, 10.0' to the coordinates of your gate when it's closed.
MoveObject(gate2, -1626.8461,688.7094,7.1875, 2.5);
MoveObject(gate3, -2593.5501,1354.8292,7.0391, 2.5, -1.00, -1.00, 48.00);
gateopen = false; //This indicates the gate is closed again. Or at least, closing.
}
}