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[] name, bool 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(GiveGunFrame, client);
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?
__________________