Timer question - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Timer question (
/showthread.php?tid=379297)
Timer question -
HighFlyer - 21.09.2012
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.
Re: Timer question -
HighFlyer - 23.09.2012
Bump.
Re: Timer question -
Cameltoe - 23.09.2012
Try to print something for each { bracket, to see what parts of the code doesn't execute.