View Single Post
Author Message
condolent
AlliedModders Donor
Join Date: Jan 2016
Location: gc_sLocation;
Old 10-11-2017 , 03:18   Stopping a non-repeatable timer
Reply With Quote #1

Hi,
How do I correctly stop a non-repeatable timer?

I made it a separate handle and named it gH_WeapRespawn and tried this on each event I want it to stop:
PHP Code:
public void OnRoundStart(Event event, const char[] namebool dontBroadcast) {
    if(
gH_WeapRespawn != null)
        
KillTimer(gH_WeapRespawn);

This is the timer:
PHP Code:
public Action WeaponRespawner(Handle timer) {
    
int client GetRandomValidClient();
    
    
RemoveEdict(g_iPistol);
    
RequestFrame(GiveGunFrameclient);
    
    
gH_WeapRespawn null;

The first code block gave me a Invalid Timer Handle error in server console.
Is that due to it being the wrong way or is it most likely something else in my code, perhaps?
I know this is the way to stop repeatable timers, but does it work the same for non-repeatable?
__________________
condolent is offline