From 56f6ac7e38c4fbecbe70b49851360d7f7193d71e Mon Sep 17 00:00:00 2001 From: jenz Date: Tue, 13 Feb 2024 22:16:53 +0100 Subject: [PATCH] okay so mapend also did not detect it just like mapstart. right after the vote is however a fitting point to set the bol --- .../scripting/mapchooser_extended_avg.sp | 49 ++++++++++++------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/mapchooser_extended/scripting/mapchooser_extended_avg.sp b/mapchooser_extended/scripting/mapchooser_extended_avg.sp index 06690bde..c2393a6d 100755 --- a/mapchooser_extended/scripting/mapchooser_extended_avg.sp +++ b/mapchooser_extended/scripting/mapchooser_extended_avg.sp @@ -140,6 +140,7 @@ bool g_MapVoteCompleted; bool g_ChangeMapAtRoundEnd; bool g_ChangeMapInProgress; bool g_HasIntermissionStarted = false; +bool g_SaveCDOnMapEnd = true; int g_mapFileSerial = -1; int g_iPlayerCount_excludeSpec; int g_iPlayerAFKTime; @@ -524,6 +525,12 @@ public void OnMapStart() return; } g_Config.Rewind(); + //this does not detect obvioulsy when there is more or less than 15 players active because its the mapstart + // nobody has connected yet. OnMapEnd also does not work for checking this. so no point setting it to false here. + if(InternalAreRestrictionsActive(true)) + g_SaveCDOnMapEnd = true; + else + g_SaveCDOnMapEnd = false; } public void OnConfigsExecuted() @@ -592,7 +599,7 @@ public void OnMapEnd() static char map[PLATFORM_MAX_PATH]; int Cooldown; - if(InternalAreRestrictionsActive(false)) + if(g_SaveCDOnMapEnd) { GetCurrentMap(map, PLATFORM_MAX_PATH); Cooldown = InternalGetMapCooldown(map); @@ -671,28 +678,34 @@ public void OnClientDisconnect(int client) public Action Command_SetNextmap(int client, int args) { - if(args < 1) - { - CReplyToCommand(client, "[MCE] Usage: sm_setnextmap "); - return Plugin_Handled; - } + if(args < 1) + { + CReplyToCommand(client, "[MCE] Usage: sm_setnextmap "); + return Plugin_Handled; + } - static char map[PLATFORM_MAX_PATH]; - GetCmdArg(1, map, PLATFORM_MAX_PATH); + static char map[PLATFORM_MAX_PATH]; + GetCmdArg(1, map, PLATFORM_MAX_PATH); - if(!IsMapValid(map)) - { - CReplyToCommand(client, "[MCE] %t", "Map was not found", map); - return Plugin_Handled; - } + if(!IsMapValid(map)) + { + CReplyToCommand(client, "[MCE] %t", "Map was not found", map); + return Plugin_Handled; + } - ShowActivity(client, "%t", "Changed Next Map", map); - LogAction(client, -1, "\"%L\" changed nextmap to \"%s\"", client, map); + ShowActivity(client, "%t", "Changed Next Map", map); + LogAction(client, -1, "\"%L\" changed nextmap to \"%s\"", client, map); - SetNextMap(map); - g_MapVoteCompleted = true; + SetNextMap(map); + g_MapVoteCompleted = true; + //checking on MapStart and MapEnd is not good enough. Players are not considered alive and on teams at those points in time. + //therefore instead applying the bool here after the mapvote completed. + if(InternalAreRestrictionsActive(false)) + g_SaveCDOnMapEnd = true; + else + g_SaveCDOnMapEnd = false; - return Plugin_Handled; + return Plugin_Handled; } public Action Command_ReloadMaps(int client, int args)