Thread: [Solved] Invalid Timer Handle
View Single Post
Timocop
AlliedModders Donor
Join Date: Mar 2013
Location: Germany
Old 10-05-2017 , 16:43   Re: Invalid Timer Handle
Reply With Quote #15

Deleting timer doesnt set myTimer to null.

PHP Code:
public Action SmokeCheckTimer(Handle timer) { 
    
ExecSmoke(); 
     
    
myTimer null;
    
//return Plugin_Stop; //Stopping the timer when using TIMER_REPEAT

and delete ignores if a handle is null. And dont use delete/CloseHandle() in timer callbacks to close/stop them.
Use return Plugin_Stop; instead. See SourceMod Docs.

PHP Code:
public void _Smoke_OnRoundStart() { 
    
delete myTimer

    if(
myTimer == null
        
myTimer CreateTimer(gc_iSmokeTimer.FloatValueSmokeCheckTimer); 


Last edited by Timocop; 10-05-2017 at 16:46.
Timocop is offline