Automatic Gates
#2

Just add a check to open the gate only if the player who is in range is a admin.

pawn Код:
forward GateCheck();
public GateCheck()
{
  for(new i; i < MAX_PLAYERS; i++) // Start the loop
  {
    if((IsPlayerInRangeOfPoint(i, 15.0, 8.0, 3.0, 10.0)) && (P_Data[playerid][pAdmin] >= 1)) //Check if any admin 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, 32.0, 12.0, 10.0, 3.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, 8.0, 3.0, 10.0, 3.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.
  }
}
Also make sure you add gates in your Admin FilterScript not in your gamemode.
Reply


Messages In This Thread
Automatic Gates - by Primard - 05.03.2015, 04:49
Re: Automatic Gates - by De4dpOol - 05.03.2015, 05:14
Re: Automatic Gates - by Primard - 05.03.2015, 05:37
Re: Automatic Gates - by hamzajaved780 - 05.03.2015, 06:14
Re: Automatic Gates - by Primard - 05.03.2015, 06:20
Re: Automatic Gates - by CalvinC - 05.03.2015, 06:24
Re: Automatic Gates - by Primard - 05.03.2015, 07:07
Re: Automatic Gates - by Primard - 07.03.2015, 14:09

Forum Jump:


Users browsing this thread: 2 Guest(s)