I get an "Invalid Timer Handle" error in server console when this stock gets executed:
PHP Code:
stock bool ClearTimer(Handle timer) {
if(timer != INVALID_HANDLE) {
CloseHandle(timer);
timer = INVALID_HANDLE;
return true;
}
return false;
}
I'm not sure why.
This is the code where it's executed:
PHP Code:
Handle myTimer = INVALID_HANDLE;
public void _Smoke_OnRoundStart() {
ClearTimer(myTimer);
myTimer = CreateTimer(1.0, SmokeCheckTimer, _, TIMER_REPEAT);
}
public Action SmokeCheckTimer(Handle timer) {
if(GetTime() < g_iSmokeTime) // Time is not up yet
return Plugin_Continue;
ExecSmoke();
return Plugin_Stop;
}
Why does it fail? How can I solve this? I read somewhere that I need to initialize the handle with INVALID_HANDLE or else it still would throw errors.
__________________