From 7290cccb9d28abd3e6393ff8b1a11fa86ab228e8 Mon Sep 17 00:00:00 2001
From: jenz <jenz@jenz.jenz>
Date: Sun, 10 Dec 2023 22:02:42 +0100
Subject: [PATCH] had forgotten check for mapstart/mapend which is needed for
 actual CD

---
 .../scripting/mapchooser_extended_avg.sp      | 22 +++++++++----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/mapchooser_extended/scripting/mapchooser_extended_avg.sp b/mapchooser_extended/scripting/mapchooser_extended_avg.sp
index 8b3317ac..9b11154d 100755
--- a/mapchooser_extended/scripting/mapchooser_extended_avg.sp
+++ b/mapchooser_extended/scripting/mapchooser_extended_avg.sp
@@ -526,7 +526,7 @@ public void OnMapStart()
     }
     g_Config.Rewind();
 
-    if(InternalAreRestrictionsActive())
+    if(InternalAreRestrictionsActive(true))
         g_SaveCDOnMapEnd = true;
     else
         g_SaveCDOnMapEnd = false;
@@ -1904,7 +1904,7 @@ void CreateNextVote()
     GetCurrentMap(map, PLATFORM_MAX_PATH);
     RemoveStringFromArray(tempMaps, map);
 
-    if(GetArraySize(tempMaps) > GetConVarInt(g_Cvar_ExcludeMaps) && InternalAreRestrictionsActive())
+    if(GetArraySize(tempMaps) > GetConVarInt(g_Cvar_ExcludeMaps) && InternalAreRestrictionsActive(false))
     {
         StringMapSnapshot OldMapListSnapshot = g_OldMapList.Snapshot();
         for(int i = 0; i < OldMapListSnapshot.Length; i++)
@@ -1915,7 +1915,7 @@ void CreateNextVote()
         delete OldMapListSnapshot;
     }
 
-    if(InternalAreRestrictionsActive())
+    if(InternalAreRestrictionsActive(false))
     {
         StringMapSnapshot TimeMapListSnapshot = g_TimeMapList.Snapshot();
         for(int i = 0; i < TimeMapListSnapshot.Length; i++)
@@ -1966,7 +1966,7 @@ void CreateNextVote()
             b = GetRandomInt(0, GetArraySize(tempMaps) - 1);
             GetArrayString(tempMaps, b, map, PLATFORM_MAX_PATH);
 
-            if(!InternalAreRestrictionsActive())
+            if(!InternalAreRestrictionsActive(false))
                 break;
 
             if(InternalGetMapVIPRestriction(map))
@@ -2402,7 +2402,7 @@ public int Native_CanNominate(Handle plugin, int numParams)
 
 public int Native_ExcludeMap(Handle plugin, int numParams)
 {
-	if(!InternalAreRestrictionsActive())
+	if(!InternalAreRestrictionsActive(false))
 		return true;
 
 	int len;
@@ -2441,7 +2441,7 @@ public int Native_ExcludeMap(Handle plugin, int numParams)
 
 public int Native_ExcludeMapTime(Handle plugin, int numParams)
 {
-	if(!InternalAreRestrictionsActive())
+	if(!InternalAreRestrictionsActive(false))
 		return true;
 
 	int len;
@@ -2483,7 +2483,7 @@ public int Native_ExcludeMapTime(Handle plugin, int numParams)
 
 public int Native_GetMapCooldown(Handle plugin, int numParams)
 {
-	if(!InternalAreRestrictionsActive())
+	if(!InternalAreRestrictionsActive(false))
 		return 0;
 
 	int len;
@@ -2503,7 +2503,7 @@ public int Native_GetMapCooldown(Handle plugin, int numParams)
 
 public int Native_GetMapCooldownTime(Handle plugin, int numParams)
 {
-	if(!InternalAreRestrictionsActive())
+	if(!InternalAreRestrictionsActive(false))
 		return 0;
 
 	int len;
@@ -2737,7 +2737,7 @@ public int Native_GetExtendsLeft(Handle plugin, int numParams)
 
 public int Native_AreRestrictionsActive(Handle plugin, int numParams)
 {
-	return InternalAreRestrictionsActive();
+	return InternalAreRestrictionsActive(false);
 }
 
 public int Native_SimulateMapEnd(Handle plugin, int numParams)
@@ -3010,7 +3010,7 @@ stock int InternalGetMapPlayerRestriction(const char[] map)
     return 0;
 }
 
-stock bool InternalAreRestrictionsActive()
+stock bool InternalAreRestrictionsActive(bool skip_player_check)
 {
     if (!GetConVarBool(g_Cvar_NoRestrictionTimeframeEnable))
         return true;
@@ -3041,7 +3041,7 @@ stock bool InternalAreRestrictionsActive()
         }
     }
 
-    if (ActivePlayerCount <= g_iPlayerCount_excludeSpec)
+    if (ActivePlayerCount <= g_iPlayerCount_excludeSpec && !skip_player_check)
     {
         return false;
     }