Auto gates ;)
#5

Your method is wrong, I'm sure you've basically copied the WIKI, but that's wrong too.

First I would start by changing the parameters on your callback. Even though you will be needing playerid, you should do a loop for all players instead of apparently having timers for all players.

pawn Code:
forward GateChecks();
new gate1,gate2;
public OnGameModeInit()
{
  gate1=CreateObject(X1,Y1,Z1);
  gate2=CreateObject(X2,Y2,Z2);
  SetTimer("GateChecks",3000,1);
  return 1;
}
public GateChecks()
{
  new PlayerNearGate1, PlayerNearGate2;
  for(new playerid,playerid<MAX_PLAYERS;playerid++)
  {
    if(IsPlayerInRangeOfPoint(playerid,X1,Y1,Z1))PlayerNearGate1=1;
    if(IsPlayerInRangeOfPoint(playerid,X2,Y2,Z2))PlayerNearGate2=1;
  }
  if(PlayerNearGate1)MoveObject(gate1,openedX1,openedY1,openedZ1);
  else MoveObject(gate1,closedX1,closedY1,closedZ1);

  if(PlayerNearGate2)MoveObject(gate2,openedX2,openedY2,openedZ2);
  else MoveObject(gate2,closedX2,closedY2,closedZ2);
}
And I hope you're smart enough to change 'closedX1' to the coordinate you need. I'm tired of people giving me errors like 'No such definition: "closedX1"' ... morons...
Reply


Messages In This Thread
Auto gates ;) - by GaGlets(R) - 23.11.2009, 17:27
Re: Auto gates ;) - by patchkinson - 23.11.2009, 17:31
Re: Auto gates ;) - by dice7 - 23.11.2009, 17:49
Re: Auto gates ;) - by GaGlets(R) - 23.11.2009, 19:57
Re: Auto gates ;) - by Joe Staff - 23.11.2009, 23:33
Re: Auto gates ;) - by GaGlets(R) - 24.11.2009, 11:45
Re: Auto gates ;) - by GaGlets(R) - 25.11.2009, 15:02
Re: Auto gates ;) - by GaGlets(R) - 25.11.2009, 16:01

Forum Jump:


Users browsing this thread: 1 Guest(s)