From 8c673f4401222c7018cf23cee29ca06cc1ddbdff Mon Sep 17 00:00:00 2001 From: jenz Date: Tue, 10 Oct 2023 00:11:30 +0200 Subject: [PATCH] fixing runoff votes as sometimes they did happen despite a map receiving over 51% of votes --- mapchooser_extended/scripting/mapchooser_extended_avg.sp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mapchooser_extended/scripting/mapchooser_extended_avg.sp b/mapchooser_extended/scripting/mapchooser_extended_avg.sp index a401281d..493bf172 100755 --- a/mapchooser_extended/scripting/mapchooser_extended_avg.sp +++ b/mapchooser_extended/scripting/mapchooser_extended_avg.sp @@ -1643,9 +1643,9 @@ public void Handler_MapVoteFinished(Handle menu, // Implement revote logic - Only run this` block if revotes are enabled and this isn't the last revote' //LogMessage("Mapchooser_extended_avg Handler_MapVoteFinished."); int required_percent = GetConVarInt(g_Cvar_RunOffPercent); - int required_votes = RoundToCeil((total_votes * float(required_percent)) / 100.0); + int most_voted_map_percentage = RoundToFloor((weighted_votes[0] / total_votes) * 100); if(GetConVarBool(g_Cvar_RunOff) && g_RunoffCount < GetConVarInt(g_Cvar_MaxRunOffs) && num_items > 1 && - (weighted_votes[0] == weighted_votes[1] || weighted_votes[0] < required_votes)) + (weighted_votes[0] == weighted_votes[1] || most_voted_map_percentage < required_percent)) { //LogMessage("Mapchooser_extended_avg Handler_MapVoteFinished passed check1."); g_RunoffCount++; @@ -1673,7 +1673,7 @@ public void Handler_MapVoteFinished(Handle menu, SetupWarningTimer(WarningType_Revote, view_as(g_ChangeTime), mapList); return; } - else if(weighted_votes[0] < required_votes) + else if(most_voted_map_percentage < required_percent) { g_HasVoteStarted = false;