23.11.2009, 23:33
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.
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...
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);
}

