Timer question
#1

Hello there,

I've made a timer on an automatic gate, in order to close it with a timer rather than doing it automatically after a vehicle passes, but it doesn't seem to be working. I've done a bit of debugging, and the console doesn't display the print from the TollClose1 public. Where have I gone wrong?

Код:
public OnGateOpenClose(gateid, openclose, Float:gatex, Float:gatey, Float:gatez)
{
    if(gateid == BARRIER_M1_LVENTRY)
    {
   		if(openclose == GATE_STATUS_OPENING)
    	{
    		foreach(new i : Player)
    		{
     			if(IsPlayerInRangeOfPoint(i, 30, 1616.196411, 148.533279, 36.277344))
				SendClientMessage(i, YELLOW, "You have paid $15 for M1 TOLL. Enjoy your journey.");
				Player[i][Money] -= 15;
				SetTimer("TollClose1", 7000, 0);
				print("start_toll_timer");
			}
		}
    }
    return 1;
}

forward TollClose1();
public TollClose1()
{
	CloseGate(BARRIER_M1_LVENTRY);
	print("stop_toll_timer");
	return 1;
}
EDIT: It prints actually now, but with a weird delay, and the gate is still not closing on a timer. It's closing after a vehicle passes instead, which is problematic for trailers for instance.
Reply
#2

Bump.
Reply
#3

Try to print something for each { bracket, to see what parts of the code doesn't execute.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)