SA-MP Forums Archive
error 021: symbol already defined: "SetTimer" - 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: error 021: symbol already defined: "SetTimer" (/showthread.php?tid=301035)



error 021: symbol already defined: "SetTimer" - reckst4r - 02.12.2011

I am getting this error: C:\Users\Thomas\Desktop\gates.pwn(10) : error 021: symbol already defined: "SetTimer"
when trying to compile my automatic gate.

Code:
PHP код:
new mygate;
SetTimer("CheckGate"1000true);
forward CheckGate();
public 
CheckGate()
{
    new 
mygate_status;
    for(new 
i;i<MAX_PLAYERS;i++)
    {
        if(!
IsPlayerConnected(i)) continue;
        if(
IsPlayerInRangeOfPoint(i,10.0,1119.30004883,-1161.19995117,24.29999924))mygate_status=1;
    }
    if(
mygate_status)MoveObject(mygate1139.30004883,-1161.19995117,24.29999924,2);
    else 
MoveObject(mygate1119.30004883,-1161.19995117,24.299999242);
}
#endif 



Re: error 021: symbol already defined: "SetTimer" - PawnoQ - 02.12.2011

where is ur settimer function located (callback?)


Re: error 021: symbol already defined: "SetTimer" - MP2 - 02.12.2011

You need to use SetTimer in a callback, not a random place in the script. I assume from the code you want a repeating timer. You should start the timer in OnGameModeInit.