#1

public CheckGate()
{
new gate_status;
for(new i;i<MAX_PLAYERS;i++)
{
if(!IsPlayerConnected(i)) continue;
if(IsPlayerInRangeOfPoint(i,10.0,-1898.22, 238.45, 35.82))gate_status=1;
else if(gPlayer[i][TEAM_1])gate_status=0;
}
if(gate_status)MoveObject(gate, -1898.22, 238.45, 35.82, 2), MoveObject(gate1, -1918.10, 238.45, 35.82, 2);
else MoveObject(gate, -1903.41, 238.47, 35.82, 2), MoveObject(gate1, -1912.25, 238.47, 35.82, 2);
}
Hi guys, what am i doing wrong here? Thanks for your answer.
BTW, it is compiling but the problem is that if TEAM_1 member is close then the gate doesn't work at all.
Reply
#2

Where did you created the gate object? and did you made a variable that is named gate that holds the object id of the gate object?

You can't use else if becuse this only gets called if the if statement before is not true, so if the player is in range of the point the else if statement to check if the player is in right gang never gets called.
Reply
#3

Jou, Olari. Use [pawn] tags, so it's easier to read for us. You are trying to make a gate, so if any player is near it it would open? And are you sure, that the timer is running?
Reply
#4

the next lines are in:
public OnGameModeInit()
SetTimer("CheckGate",1000,true);
gate = CreateObject(975, -1903.41, 238.47, 35.82, 0.00, 0.00, 0.00); //gate left
gate1 = CreateObject(975, -1912.25, 238.47, 35.82, 0.00, 0.00, 0.00); //gate right
BTW dan, what do you mean [pawn] tags?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)