SA-MP Forums Archive
auto gates 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: auto gates problem (/showthread.php?tid=164462)



auto gates problem - billiout - 31.07.2010

i have a problem with the auto gates. here is the code i dont why they dont move it seems ok no errors.

Код:
forward SouthernCopGate();
forward SouthernCopGateClose();

new southcopgate;
new westcopgate;
new GateSouthern =0; // closed
new GateWestern =0; // closed

OnGameModeInit()
{
    	southcopgate = CreateObject(16775, 2320.6426,2445.9233,5.2734, 0,0,90.0); //lvpd southern gate
        westcopgate = CreateObject(16775, 2294.1990,2500.2039,4.2959, 0,0,90.0); //lvpd western gate

        SetTimer("SouthernCopGate",1000,1);
	SetTimer("WesternCopGate",1000,1);
        return 1;
}

public SouthernCopGate()
{
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
		if(IsPlayerConnected(i) && IsSpawned[i] == 1)
		{
          new Float:x, Float:y, Float:z;
	      GetPlayerPos(i, x, y, z);
          if(x >= 2321.0969 && x <= 2336.8127 && y >= 2439.5466 && y <= 2451.8848 || x >= 2310.2278 && x <= 2320.1902 && y >= 2440.9089 && y <= 2452.2144)
          {
		  if(gTeam[i] == TEAM_COPS)
		  {
		  if(GateSouthern == 0) // closed
		  {
            MoveObject(southcopgate, 2320.6426,2445.9233,-2.0000, 2);
            GateSouthern =1; // open
            SetTimer("SouthernCopGateClose",5000,0);
           	
		  }
		 }
		}
	  }
	}
  }
public SouthernCopGateClose()
{
       if(GateSouthern == 1) // open
	   {
            MoveObject(southcopgate, 2320.6426,2445.9233,5.2734, 2);
            GateSouthern =0; // closed

        }
      }
public WesternCopGate()
{
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
		if(IsPlayerConnected(i) && IsSpawned[i] == 1)
		{
          new Float:x, Float:y, Float:z;
	      GetPlayerPos(i, x, y, z);
          if(x >= 2284.3335 && x <= 2304.8169 && y >= 2492.2542 && y <= 2502.3809)
          {
		  if(gTeam[i] == TEAM_COPS)
		  {
		  if(GateWestern == 0) // closed
		  {
            MoveObject(westcopgate, 2294.1990,2510.2039,4.2959, 2);
            GateWestern =1; // open
            SetTimer("WesternCopGateClose",5000,0);
           	
		  }
		 }
		}
	  }
	}
  }
public WesternCopGateClose()
{
       if(GateWestern == 1) // open
	   {
            MoveObject(westcopgate, 2294.1990,2500.2039,4.2959, 2);
            GateWestern =0; // closed

        }
      }
pls help me!!!


Re: auto gates problem - MyLife - 31.07.2010

Try...

pawn Код:
forward SouthernCopGate();
forward SouthernCopGateClose();

new southcopgate;
new westcopgate;
new GateSouthern =0; // closed
new GateWestern =0; // closed

OnGameModeInit()
{
        southcopgate = CreateObject(16775, 2320.6426,2445.9233,5.2734, 0,0,90.0); //lvpd southern gate
        westcopgate = CreateObject(16775, 2294.1990,2500.2039,4.2959, 0,0,90.0); //lvpd western gate

        SetTimer("SouthernCopGate",1000,1);
    SetTimer("WesternCopGate",1000,1);
        return 1;
}

public SouthernCopGate()
{
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && IsSpawned[i] == 1)
        {
          new Float:x, Float:y, Float:z;
          GetPlayerPos(i, x, y, z);
          if(x >= 2321.0969 && x <= 2336.8127 && y >= 2439.5466 && y <= 2451.8848 || x >= 2310.2278 && x <= 2320.1902 && y >= 2440.9089 && y <= 2452.2144)
          {
          if(gTeam[i] == TEAM_COPS)
          {
          if(GateSouthern == 0) // closed
          {
if(PlayerToPoint(15.0, playerid,2320.6426,2445.9233,5.2734))
{
            MoveObject(southcopgate, 2320.6426,2445.9233,-2.0000, 2);
            GateSouthern =1; // open
            SetTimer("SouthernCopGateClose",5000,0);
}
          }
         }
        }
      }
    }
  }
public SouthernCopGateClose()
{
       if(GateSouthern == 1) // open
       {
            MoveObject(southcopgate, 2320.6426,2445.9233,5.2734, 2);
            GateSouthern =0; // closed

        }
      }
public WesternCopGate()
{
    for (new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i) && IsSpawned[i] == 1)
        {
          new Float:x, Float:y, Float:z;
          GetPlayerPos(i, x, y, z);
          if(x >= 2284.3335 && x <= 2304.8169 && y >= 2492.2542 && y <= 2502.3809)
          {
          if(gTeam[i] == TEAM_COPS)
          {
          if(GateWestern == 0) // closed
          {
if(PlayerToPoint(15.0, playerid,2294.1990,2500.2039,4.2959))
{

            MoveObject(westcopgate, 2294.1990,2510.2039,4.2959, 2);
            GateWestern =1; // open
            SetTimer("WesternCopGateClose",5000,0);
}
          }
         }
        }
      }
    }
  }
public WesternCopGateClose()
{
       if(GateWestern == 1) // open
       {
            MoveObject(westcopgate, 2294.1990,2500.2039,4.2959, 2);
            GateWestern =0; // closed

        }
      }



Re: auto gates problem - billiout - 31.07.2010

doent worked. i changed it to isplayerinrangeofpoint but still doent work.


Re: auto gates problem - billiout - 31.07.2010

bump!!!!!!!!!!


Re: auto gates problem - billiout - 01.08.2010

bump!!!!!!!!!! pls help