should safeguard votes from happening when the last vote is done, except of revotes of coruse
This commit is contained in:
		
							parent
							
								
									dc7cdd5e10
								
							
						
					
					
						commit
						39628347b9
					
				@ -144,6 +144,7 @@ bool g_HasIntermissionStarted = false;
 | 
				
			|||||||
bool g_SaveCDOnMapEnd = true;
 | 
					bool g_SaveCDOnMapEnd = true;
 | 
				
			||||||
bool g_DidNotExtend = false;
 | 
					bool g_DidNotExtend = false;
 | 
				
			||||||
bool g_DidRoundTerminate = false;
 | 
					bool g_DidRoundTerminate = false;
 | 
				
			||||||
 | 
					bool g_IniatedLastVote = false;
 | 
				
			||||||
int g_mapFileSerial = -1;
 | 
					int g_mapFileSerial = -1;
 | 
				
			||||||
int g_iPlayerCount_excludeSpec;
 | 
					int g_iPlayerCount_excludeSpec;
 | 
				
			||||||
int g_iPlayerAFKTime;
 | 
					int g_iPlayerAFKTime;
 | 
				
			||||||
@ -490,6 +491,7 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max
 | 
				
			|||||||
public void OnMapStart()
 | 
					public void OnMapStart()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    g_DidRoundTerminate = false;
 | 
					    g_DidRoundTerminate = false;
 | 
				
			||||||
 | 
					    g_IniatedLastVote = false;
 | 
				
			||||||
    g_DidNotExtend = false;
 | 
					    g_DidNotExtend = false;
 | 
				
			||||||
    ServerCommand("sm_cvar sm_vote_progress_hintbox 1"); //yeah its cheesy but does the job.
 | 
					    ServerCommand("sm_cvar sm_vote_progress_hintbox 1"); //yeah its cheesy but does the job.
 | 
				
			||||||
    g_iInterval = 0;
 | 
					    g_iInterval = 0;
 | 
				
			||||||
@ -593,6 +595,7 @@ public void OnMapEnd()
 | 
				
			|||||||
    g_HasVoteStarted = false;
 | 
					    g_HasVoteStarted = false;
 | 
				
			||||||
    g_WaitingForVote = false;
 | 
					    g_WaitingForVote = false;
 | 
				
			||||||
    g_DidRoundTerminate = false;
 | 
					    g_DidRoundTerminate = false;
 | 
				
			||||||
 | 
					    g_IniatedLastVote = false;
 | 
				
			||||||
    g_ChangeMapAtRoundEnd = false;
 | 
					    g_ChangeMapAtRoundEnd = false;
 | 
				
			||||||
    g_ChangeMapInProgress = false;
 | 
					    g_ChangeMapInProgress = false;
 | 
				
			||||||
    g_HasIntermissionStarted = false;
 | 
					    g_HasIntermissionStarted = false;
 | 
				
			||||||
@ -785,7 +788,7 @@ void SetupTimeleftTimer()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if(time - startTime < 0 && GetConVarBool(g_Cvar_EndOfMapVote) && !g_MapVoteCompleted && !g_HasVoteStarted && !g_WaitingForVote)
 | 
					        if(time - startTime < 0 && GetConVarBool(g_Cvar_EndOfMapVote) && !g_MapVoteCompleted && !g_HasVoteStarted && !g_WaitingForVote)
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (!g_DidNotExtend)
 | 
					            if (!g_DidNotExtend && !g_IniatedLastVote)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                SetupWarningTimer(WarningType_Vote);
 | 
					                SetupWarningTimer(WarningType_Vote);
 | 
				
			||||||
                //PrintToChatAll("SetupWarningTimer 1");
 | 
					                //PrintToChatAll("SetupWarningTimer 1");
 | 
				
			||||||
@ -819,8 +822,11 @@ public Action Timer_StartWarningTimer(Handle timer)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if(!g_WarningInProgress || g_WarningTimer == INVALID_HANDLE)
 | 
					    if(!g_WarningInProgress || g_WarningTimer == INVALID_HANDLE)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        SetupWarningTimer(WarningType_Vote);
 | 
					        if (!g_IniatedLastVote)
 | 
				
			||||||
        //PrintToChatAll("SetupWarningTimer 2");
 | 
					        {
 | 
				
			||||||
 | 
					            SetupWarningTimer(WarningType_Vote);
 | 
				
			||||||
 | 
					            //PrintToChatAll("SetupWarningTimer 2");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return Plugin_Stop;
 | 
					    return Plugin_Stop;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -955,7 +961,11 @@ public Action CS_OnTerminateRound(float &delay, CSRoundEndReason &reason)
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    if (timeleft <= 0 && !g_ChangeMapAtRoundEnd)
 | 
					    if (timeleft <= 0 && !g_ChangeMapAtRoundEnd)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        InitiateVote(MapChange_Instant); //feature so mapvote happens at actual mapend
 | 
					        if (!g_IniatedLastVote)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            g_IniatedLastVote = true;
 | 
				
			||||||
 | 
					            InitiateVote(MapChange_Instant); //feature so mapvote happens at actual mapend
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
        return Plugin_Handled;
 | 
					        return Plugin_Handled;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    g_DidRoundTerminate = false;
 | 
					    g_DidRoundTerminate = false;
 | 
				
			||||||
@ -978,7 +988,7 @@ public void Event_RoundEnd(Handle event, const char[] name, bool dontBroadcast)
 | 
				
			|||||||
	if(g_RoundCounting == RoundCounting_ArmsRace)
 | 
						if(g_RoundCounting == RoundCounting_ArmsRace)
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(g_ChangeMapAtRoundEnd)
 | 
						if(g_ChangeMapAtRoundEnd && !g_IniatedLastVote)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		g_ChangeMapAtRoundEnd = false;
 | 
							g_ChangeMapAtRoundEnd = false;
 | 
				
			||||||
		CreateTimer(2.0, Timer_ChangeMap, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE);
 | 
							CreateTimer(2.0, Timer_ChangeMap, INVALID_HANDLE, TIMER_FLAG_NO_MAPCHANGE);
 | 
				
			||||||
@ -1086,7 +1096,6 @@ public Action Command_Mapvote(int client, int args)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    SetupWarningTimer(WarningType_Vote, MapChange_MapEnd, INVALID_HANDLE, true);
 | 
					    SetupWarningTimer(WarningType_Vote, MapChange_MapEnd, INVALID_HANDLE, true);
 | 
				
			||||||
    //PrintToChatAll("SetupWarningTimer 6");
 | 
					    //PrintToChatAll("SetupWarningTimer 6");
 | 
				
			||||||
    //LogMessage("Mapchooser_extended_avg SetupWarningTimer call 7");
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return Plugin_Handled;
 | 
					    return Plugin_Handled;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -2342,9 +2351,12 @@ public int Native_InitiateVote(Handle plugin, int numParams)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    LogAction(-1, -1, "Starting map vote because outside request");
 | 
					    LogAction(-1, -1, "Starting map vote because outside request");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    SetupWarningTimer(WarningType_Vote, when, inputarray);
 | 
					    if (!g_IniatedLastVote)
 | 
				
			||||||
    //PrintToChatAll("SetupWarningTimer 9");
 | 
					    {
 | 
				
			||||||
    //LogMessage("Mapchooser_extended_avg SetupWarningTimer call 1");
 | 
					        SetupWarningTimer(WarningType_Vote, when, inputarray);
 | 
				
			||||||
 | 
					        //PrintToChatAll("SetupWarningTimer 9");
 | 
				
			||||||
 | 
					        //LogMessage("Mapchooser_extended_avg SetupWarningTimer call 1");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    return 0;
 | 
					    return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user