SA-MP Forums Archive
Gate Problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Gate Problem (/showthread.php?tid=578527)



Gate Problem - STONEGOLD - 20.06.2015

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"800true); //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.000.0000.00);
    
gate2 CreateObject(971, -1626.8461,688.7094,7.1875,   0.000.0000.00);
    
gate3 CreateObject(971, -2593.5501,1354.8292,7.0391,   -1.00, -1.0048.00);
    
CreateObject(19870, -1621.8461,688.7094,7.1875,   0.000.0000.00);
public 
GateCheck()
{
  for(new 
iMAX_PLAYERSi++) // Start the loop
  
{
    if(!
IsPlayerConnected(i)) continue;
    if(
gTeam[i] == COPS || gTeam[i] == ARMY || gTeam[i] == FBI || gTeam[i] == CIA)
    {
      if(
IsPlayerInRangeOfPoint(i10.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.18752.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.18752.5);
           
MoveObject(gate3, -2493.5501,1354.8292,-7.03912.5, -1.00, -1.0048.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.18752.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.18752.5);
    
MoveObject(gate3, -2593.5501,1354.8292,7.03912.5, -1.00, -1.0048.00);
    
gateopen false//This indicates the gate is closed again. Or at least, closing.
  
}




Re: Gate Problem - baba1234 - 20.06.2015

I woulde check those co-ordinates you see u have 4 co-ordinates on gate and gate 2 but on gate 3 u have 7 co-ordinates chack that.


Re: Gate Problem - Neos07 - 20.06.2015

Because the coordinates of the gate3 didn't changed!


Re: Gate Problem - Hessu - 20.06.2015

See at the gate3 parameters and take a look what there should be: (objectid, Float:X, Float:Y, Float:Z, Float:Speed, Float:RotX = -1000.0, Float:RotY = -1000.0, Float:RotZ = -1000.0)


Re: Gate Problem - Darrenr - 20.06.2015

Change the first MoveObject to look like this:

Код:
MoveObject(gate3, -2493.5501,1354.8292,-2.0391, 2.5, -1.00, -1.00, 48.00);
All I've done it changed -7 to -2 so that it moves... just like you have already done with gate2 and gate


Re: Gate Problem - STONEGOLD - 20.06.2015

^^ doesn't work.


Re: Gate Problem - Darrenr - 20.06.2015

Quote:
Originally Posted by STONEGOLD
Посмотреть сообщение
^^ doesn't work.
Did you change the first MoveObject (not the CreateObject)

EDIT:

Might also be worth trying to remove the last 3 arguments from both MoveObject functions?

Код:
MoveObject(gate3, -2593.5501,1354.8292,7.0391, 2.5, -1.00, -1.00, 48.00);
to
Код:
MoveObject(gate3, -2593.5501,1354.8292,7.0391, 2.5);