diff --git a/mapchooser_extended/scripting/mapchooser_extended_avg_mapend.sp b/mapchooser_extended/scripting/mapchooser_extended_avg_mapend.sp index f1ec841a..8c0d1ea5 100755 --- a/mapchooser_extended/scripting/mapchooser_extended_avg_mapend.sp +++ b/mapchooser_extended/scripting/mapchooser_extended_avg_mapend.sp @@ -143,6 +143,7 @@ bool g_ChangeMapInProgress; bool g_HasIntermissionStarted = false; bool g_SaveCDOnMapEnd = true; bool g_DidNotExtend = false; +bool g_DidRoundTerminate = false; int g_mapFileSerial = -1; int g_iPlayerCount_excludeSpec; int g_iPlayerAFKTime; @@ -488,6 +489,7 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max public void OnMapStart() { + g_DidRoundTerminate = false; g_DidNotExtend = false; ServerCommand("sm_cvar sm_vote_progress_hintbox 1"); //yeah its cheesy but does the job. g_iInterval = 0; @@ -590,6 +592,7 @@ public void OnMapEnd() g_iInterval = 0; g_HasVoteStarted = false; g_WaitingForVote = false; + g_DidRoundTerminate = false; g_ChangeMapAtRoundEnd = false; g_ChangeMapInProgress = false; g_HasIntermissionStarted = false; @@ -945,8 +948,9 @@ public Action CS_OnTerminateRound(float &delay, CSRoundEndReason &reason) { int timeleft; GetMapTimeLeft(timeleft); - if (g_WaitingForVote) + if (g_WaitingForVote && timeleft <= 0) { + g_DidRoundTerminate = true; return Plugin_Handled; //it keeps retriggering this Action. } if (timeleft <= 0 && !g_ChangeMapAtRoundEnd) @@ -954,12 +958,14 @@ public Action CS_OnTerminateRound(float &delay, CSRoundEndReason &reason) InitiateVote(MapChange_Instant); //feature so mapvote happens at actual mapend return Plugin_Handled; } + g_DidRoundTerminate = false; return Plugin_Continue; } /* 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) { + g_DidRoundTerminate = false; if(g_ChangeMapAtRoundEnd) { char map[32]; @@ -1320,7 +1326,7 @@ void InitiateVote(MapChange when, Handle inputlist=INVALID_HANDLE) AddExtendToMenu(g_VoteMenu, when); //AddMenuItem(g_VoteMenu, LINE_ONE, "Choose something...", ITEMDRAW_DISABLED); AddMapItem("Dont extend"); - + SetMenuOptionFlags(g_VoteMenu, MENUFLAG_BUTTON_NOVOTE); //should add no vote option for the extend vote? } /* No input given - User our internal nominations and maplist */ else if(inputlist == INVALID_HANDLE) @@ -1646,7 +1652,8 @@ public void Handler_VoteFinishedGeneric(char[] map, //SetNextMap(map); //feature edit where MapChange_MapEnd is only used to decide if extend or not extend g_DidNotExtend = true; //just so warningtimer wont start running again if an admin removes or adds time when players voted to not extend. } - else if(g_ChangeTime == MapChange_Instant) + else if(g_ChangeTime == MapChange_Instant || g_DidRoundTerminate) //g_DidRoundTerminate implies that rtv vote is running while the last round already ended. + //therefore rtv vote has to switch map right now instead of roundend. { PrintToChatAll("[MCE] Next Map: %s", map); PrintToChatAll("[MCE] Next Map: %s", map); @@ -1767,7 +1774,7 @@ public void Handler_MapVoteFinished(Handle menu, //LogMessage("Mapchooser_extended_avg Handler_MapVoteFinished."); int required_percent = GetConVarInt(g_Cvar_RunOffPercent); 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 && + if(GetConVarBool(g_Cvar_RunOff) && g_RunoffCount < GetConVarInt(g_Cvar_MaxRunOffs) && num_items > 1 && g_ChangeTime != MapChange_MapEnd && (weighted_votes[0] == weighted_votes[1] || most_voted_map_percentage < required_percent)) { //LogMessage("Mapchooser_extended_avg Handler_MapVoteFinished passed check1.");