diff --git a/plugins/include/mapchooser.inc b/plugins/include/mapchooser.inc index 541f30c5..9576e214 100644 --- a/plugins/include/mapchooser.inc +++ b/plugins/include/mapchooser.inc @@ -57,9 +57,18 @@ native InitiateMapChooserVote(MapChange:when, Handle:inputarray=INVALID_HANDLE); /** * Checks if MapChooser's end of map vote has completed. + * + * @return True if complete, false otherwise. */ native bool:HasEndOfMapVoteFinished(); +/** + * Checks if MapChooser is set to run an end of map vote. + * + * @return True if enabled, false otherwise. + */ +native bool:EndOfMapVoteEnabled(); + /** * Called when mapchooser removes a nomination from its list. * Nominations cleared on map start will not trigger this forward diff --git a/plugins/mapchooser.sp b/plugins/mapchooser.sp index 0bb452e5..dd820e86 100644 --- a/plugins/mapchooser.sp +++ b/plugins/mapchooser.sp @@ -166,6 +166,7 @@ public bool:AskPluginLoad(Handle:myself, bool:late, String:error[], err_max) CreateNative("CanMapChooserStartVote", Native_CanVoteStart); CreateNative("HasEndOfMapVoteFinished", Native_CheckVoteDone); CreateNative("GetExcludeMapList", Native_GetExcludeMapList); + CreateNative("EndOfMapVoteEnabled", Native_EndOfMapVoteEnabled); return true; } @@ -218,6 +219,7 @@ public OnMapEnd() { g_HasVoteStarted = false; g_WaitingForVote = false; + g_ChangeMapAtRoundEnd = false; g_VoteTimer = INVALID_HANDLE; g_RetryTimer = INVALID_HANDLE; @@ -312,11 +314,6 @@ SetupTimeleftTimer() public Action:Timer_StartMapVote(Handle:timer) { - if (!GetArraySize(g_MapList) || !GetConVarBool(g_Cvar_EndOfMapVote) || g_MapVoteCompleted || g_HasVoteStarted) - { - return Plugin_Stop; - } - if (timer == g_RetryTimer) { g_RetryTimer = INVALID_HANDLE; @@ -326,6 +323,11 @@ public Action:Timer_StartMapVote(Handle:timer) g_VoteTimer = INVALID_HANDLE; } + if (!GetArraySize(g_MapList) || !GetConVarBool(g_Cvar_EndOfMapVote) || g_MapVoteCompleted || g_HasVoteStarted) + { + return Plugin_Stop; + } + InitiateVote(MapChange_MapEnd, INVALID_HANDLE); return Plugin_Stop; @@ -931,14 +933,14 @@ public Native_CanVoteStart(Handle:plugin, numParams) public Native_CheckVoteDone(Handle:plugin, numParams) { - if (GetConVarBool(g_Cvar_EndOfMapVote) == false) - { - return true; - } - return g_MapVoteCompleted; } +public Native_EndOfMapVoteEnabled(Handle:plugin, numParams) +{ + return GetConVarBool(g_Cvar_EndOfMapVote); +} + public Native_GetExcludeMapList(Handle:plugin, numParams) { new Handle:array = Handle:GetNativeCell(1); diff --git a/plugins/rockthevote.sp b/plugins/rockthevote.sp index 7ed1cd96..454217a1 100644 --- a/plugins/rockthevote.sp +++ b/plugins/rockthevote.sp @@ -250,7 +250,7 @@ StartRTV() return; } - if (HasEndOfMapVoteFinished()) + if (EndOfMapVoteEnabled() && HasEndOfMapVoteFinished()) { /* Change right now then */ new String:map[65];