Quote:
Originally Posted by Halt
This crash's 100% of the time, and I'm not entirely sure why. I believe I've included all the related code below. All I'm attempting to do is kill the timer which would call the Humans win callback, but if all humans die prior to the time expiring then the timer needs to be killed.
Code:
//Global Array
Handle g_hTimer;
//RoundStart callback
float delay = 1.0 * GetConVarInt(g_cvRoundTime) * 60 - 2;
g_hTimer = CreateTimer(delay, Timer_HumansWinEvent, _, TIMER_FLAG_NO_MAPCHANGE);
//RoundEnd callback (KillTimer is the error line)
if(g_hTimer != INVALID_HANDLE)
{
KillTimer(g_hTimer);
g_hTimer = INVALID_HANDLE;
}
//Error
L 11/11/2020 - 15:22:01: [SM] Exception reported: Invalid timer handle 686100fc (error 1)
L 11/11/2020 - 15:22:01: [SM] Blaming: cZomRevamp3.smx
L 11/11/2020 - 15:22:01: [SM] Call stack trace:
L 11/11/2020 - 15:22:01: [SM] [0] KillTimer
Edit - Shouldn't need to add this here, but the game only crash's on RoundEnd when KillTimer is called. Otherwise no issues (that I've noticed).
|
Common mistake, using timer flag
TIMER_FLAG_NO_MAPCHANGE
-
This stop timer when map change.
- This
not clear Handle were you created timer.
- Remove flag or clear Handle at
OnMapStart()