Gates aren't moving.
#7

Quote:
Originally Posted by yugokoral
Whats the different between this script above and this script, where you put OpenGate[MAX_PLAYERS]...
pawn Код:
new OpenGate[MAX_PLAYERS];
public CheckGate()
{
  for(new i = 0; i < GetMaxPlayers(); i++)
  {
    if(!IsPlayerConnected(i)) continue;
    if(PlayerToPoint(10.0, i, closed_X, closed_Y, closed_Z) && OpenGate[i] == 0)
    {
      MoveObject(c_gate, open_X, open_Y, open_Z);
      OpenGate[i] = 1;
    }
    else if(!PlayerToPoint(10.0, i, closed_X, closed_Y, closed_Z) && OpenGate[i] == 1)
    {
      MoveObject(c_gate, closed_X, closed_Y, closed_Z);
      OpenGate[i] = 0;
    }
  }
}
It's different because the OpenGate[MAX_PLAYERS]; means it can be open for some players and closed for others, which makes no sense. It has to be open for all players or closed for al players. And if you go by the loop, if player 1 is next to the gate it will open, but if player 2 is away from the gate it will close. And sense the loop is going in numerical order it will run the functions like this

Код:
Player 1 - Near Gate - open
Player 2 - Near Gate - open
Player 3 - Away from gate - Close
Because close is last, it will stay closed for all players.
Reply


Messages In This Thread
Gates aren't moving. - by [mad]MLK - 31.10.2009, 19:38
Re: Gates aren't moving. - by member - 31.10.2009, 20:20
Re: Gates aren't moving. - by ev0lution - 31.10.2009, 21:11
Re: Gates aren't moving. - by [mad]MLK - 31.10.2009, 21:25
Re: Gates aren't moving. - by Joe Staff - 01.11.2009, 00:33
Re: Gates aren't moving. - by yugokoral - 01.11.2009, 08:23
Re: Gates aren't moving. - by Joe Staff - 01.11.2009, 19:48
Re: Gates aren't moving. - by yugokoral - 01.11.2009, 20:12
Re: Gates aren't moving. - by Synkro93 - 01.11.2009, 20:18
Re: Gates aren't moving. - by yugokoral - 01.11.2009, 20:48

Forum Jump:


Users browsing this thread: 1 Guest(s)