Fixed double timer issue.

This commit is contained in:
shavit 2017-11-15 04:47:28 +02:00
parent 6ba9fe5499
commit 61d4541361

View File

@ -60,6 +60,9 @@ int gI_MinimumTimes = 5;
int gI_PlayerAmount = 25; int gI_PlayerAmount = 25;
bool gB_Style = true; bool gB_Style = true;
// misc cache
Handle gH_Timer = null;
// table prefix // table prefix
char gS_MySQLPrefix[32]; char gS_MySQLPrefix[32];
@ -128,6 +131,19 @@ public void OnConVarChanged(ConVar convar, const char[] oldValue, const char[] n
gI_MinimumTimes = gCV_MinimumTimes.IntValue; gI_MinimumTimes = gCV_MinimumTimes.IntValue;
gI_PlayerAmount = gCV_PlayerAmount.IntValue; gI_PlayerAmount = gCV_PlayerAmount.IntValue;
gB_Style = gCV_Style.BoolValue; gB_Style = gCV_Style.BoolValue;
if(convar == gCV_ForceMapEnd)
{
if(gB_ForceMapEnd)
{
gH_Timer = CreateTimer(1.0, Timer_PrintToChat, 0, TIMER_REPEAT);
}
else
{
delete gH_Timer;
}
}
} }
public void OnConfigsExecuted() public void OnConfigsExecuted()
@ -168,9 +184,9 @@ public void OnMapStart()
SetLimit(RoundToNearest(gF_DefaultLimit)); SetLimit(RoundToNearest(gF_DefaultLimit));
} }
if(gB_ForceMapEnd) if(gB_ForceMapEnd && gH_Timer == null)
{ {
CreateTimer(1.0, Timer_PrintToChat, 0, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); gH_Timer = CreateTimer(1.0, Timer_PrintToChat, 0, TIMER_REPEAT);
} }
} }