Raised This Month: $51 Target: $400
 12% 

Solved Invalid Timer Handle


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
condolent
AlliedModders Donor
Join Date: Jan 2016
Location: gc_sLocation;
Old 10-04-2017 , 16:17   Invalid Timer Handle
Reply With Quote #1

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.0SmokeCheckTimer_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.
__________________

Last edited by condolent; 10-06-2017 at 10:49.
condolent is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:05.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode