From 04e56aeeaa54c914d0ab9d56ce927a203ec99620 Mon Sep 17 00:00:00 2001 From: jenz Date: Sat, 28 Sep 2024 17:39:28 +0200 Subject: [PATCH] added check so mapchange actually happens if nextmap is set and time is ran out --- .../mapchooser_extended_avg_mapend.sp | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/mapchooser_extended/scripting/mapchooser_extended_avg_mapend.sp b/mapchooser_extended/scripting/mapchooser_extended_avg_mapend.sp index d180bf43..67ddeeb5 100755 --- a/mapchooser_extended/scripting/mapchooser_extended_avg_mapend.sp +++ b/mapchooser_extended/scripting/mapchooser_extended_avg_mapend.sp @@ -820,6 +820,7 @@ void SetupTimeleftTimer() if (!g_DidNotExtend && !g_IniatedLastVote) { SetupWarningTimer(WarningType_Vote); + LogMessage("SetupWarningTimer 1"); //PrintToChatAll("SetupWarningTimer 1"); } } @@ -860,6 +861,7 @@ public Action Timer_StartWarningTimer(Handle timer) if (!g_IniatedLastVote) { SetupWarningTimer(WarningType_Vote); + LogMessage("SetupWarningTimer 2"); //PrintToChatAll("SetupWarningTimer 2"); } } @@ -987,6 +989,12 @@ public void Event_WeaponRank(Handle event, const char[] name, bool dontBroadcast public Action CS_OnTerminateRound(float &delay, CSRoundEndReason &reason) { + char map[PLATFORM_MAX_PATH]; + if (GetNextMap(map, sizeof(map))) //a nextmap is already set, no votes should be done. + { + return Plugin_Continue; + } + int timeleft; GetMapTimeLeft(timeleft); if (g_WaitingForVote && timeleft <= 0) @@ -1046,10 +1054,17 @@ public Action Timer_fall_back_map_switch(Handle hTimer, Handle dp) /* You ask, why don't you just use team_score event? And I answer... Because CSS doesn't. */ public void Event_RoundEnd(Handle event, const char[] name, bool dontBroadcast) { + int timeleft; + GetMapTimeLeft(timeleft); + char map[PLATFORM_MAX_PATH]; + if (GetNextMap(map, sizeof(map)) && timeleft <= 0) //a nextmap is already set, if its also the last round we need to change the map. + { + g_ChangeMapAtRoundEnd = true; + } + g_DidRoundTerminate = false; if(g_ChangeMapAtRoundEnd) { - char map[32]; GetNextMap(map, sizeof(map)); PrintToChatAll("[MCE] Next Map: %s", map); PrintToChatAll("[MCE] Next Map: %s", map); @@ -1152,6 +1167,7 @@ public Action Event_PlayerDeath(Handle event, const char[] name, bool dontBroadc if(!g_WarningInProgress || g_WarningTimer == INVALID_HANDLE) { SetupWarningTimer(WarningType_Vote, MapChange_MapEnd); + LogMessage("SetupWarningTimer 5"); //PrintToChatAll("SetupWarningTimer 5"); } } @@ -1163,6 +1179,7 @@ public Action Command_Mapvote(int client, int args) ShowActivity2(client, "[MCE] ", "%t", "Initiated Vote Map"); SetupWarningTimer(WarningType_Vote, MapChange_MapEnd, INVALID_HANDLE, true); + LogMessage("SetupWarningTimer 6"); //PrintToChatAll("SetupWarningTimer 6"); return Plugin_Handled; @@ -2443,6 +2460,7 @@ public int Native_InitiateVote(Handle plugin, int numParams) if (!g_IniatedLastVote) { SetupWarningTimer(WarningType_Vote, when, inputarray); + LogMessage("SetupWarningTimer 9"); //PrintToChatAll("SetupWarningTimer 9"); } return 0;