fix sm_rtv_autodisable
This commit is contained in:
		
							parent
							
								
									e5b7d5067f
								
							
						
					
					
						commit
						ddfe708037
					
				@ -67,7 +67,6 @@ int g_Voters = 0;				// Total voters connected. Doesn't include fake clients.
 | 
				
			|||||||
int g_Votes = 0;				// Total number of "say rtv" votes
 | 
					int g_Votes = 0;				// Total number of "say rtv" votes
 | 
				
			||||||
int g_VotesNeeded = 0;			// Necessary votes before map vote begins. (voters * percent_needed)
 | 
					int g_VotesNeeded = 0;			// Necessary votes before map vote begins. (voters * percent_needed)
 | 
				
			||||||
bool g_Voted[MAXPLAYERS+1] = {false, ...};
 | 
					bool g_Voted[MAXPLAYERS+1] = {false, ...};
 | 
				
			||||||
Handle g_TimeOverTimer = INVALID_HANDLE;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool g_InChange = false;
 | 
					bool g_InChange = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -118,7 +117,6 @@ public void OnMapEnd()
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	g_CanRTV = false;
 | 
						g_CanRTV = false;
 | 
				
			||||||
	g_RTVAllowed = false;
 | 
						g_RTVAllowed = false;
 | 
				
			||||||
	g_TimeOverTimer = INVALID_HANDLE;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public void OnConfigsExecuted()
 | 
					public void OnConfigsExecuted()
 | 
				
			||||||
@ -126,12 +124,6 @@ public void OnConfigsExecuted()
 | 
				
			|||||||
	g_CanRTV = true;
 | 
						g_CanRTV = true;
 | 
				
			||||||
	g_RTVAllowed = false;
 | 
						g_RTVAllowed = false;
 | 
				
			||||||
	CreateTimer(g_Cvar_InitialDelay.FloatValue, Timer_DelayRTV, _, TIMER_FLAG_NO_MAPCHANGE);
 | 
						CreateTimer(g_Cvar_InitialDelay.FloatValue, Timer_DelayRTV, _, TIMER_FLAG_NO_MAPCHANGE);
 | 
				
			||||||
	SetupTimeOverTimer();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public void OnMapTimeLeftChanged()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	SetupTimeOverTimer();
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public void OnClientPutInServer(int client)
 | 
					public void OnClientPutInServer(int client)
 | 
				
			||||||
@ -181,7 +173,7 @@ void UpdateRTV()
 | 
				
			|||||||
	if (g_Votes &&
 | 
						if (g_Votes &&
 | 
				
			||||||
		g_Voters &&
 | 
							g_Voters &&
 | 
				
			||||||
		g_Votes >= g_VotesNeeded &&
 | 
							g_Votes >= g_VotesNeeded &&
 | 
				
			||||||
		g_RTVAllowed )
 | 
							RTVAllowed())
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		if (g_Cvar_RTVPostVoteAction.IntValue == 1 && HasEndOfMapVoteFinished())
 | 
							if (g_Cvar_RTVPostVoteAction.IntValue == 1 && HasEndOfMapVoteFinished())
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@ -223,7 +215,7 @@ public Action Command_RTV(int client, int args)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void AttemptRTV(int client)
 | 
					void AttemptRTV(int client)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (!g_RTVAllowed  || (g_Cvar_RTVPostVoteAction.IntValue == 1 && HasEndOfMapVoteFinished()))
 | 
						if (!RTVAllowed() || (g_Cvar_RTVPostVoteAction.IntValue == 1 && HasEndOfMapVoteFinished()))
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		ReplyToCommand(client, "[RTVE] %t", "RTV Not Allowed");
 | 
							ReplyToCommand(client, "[RTVE] %t", "RTV Not Allowed");
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
@ -365,25 +357,14 @@ public Action Command_EnableRTV(int client, int args)
 | 
				
			|||||||
	return Plugin_Handled;
 | 
						return Plugin_Handled;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void SetupTimeOverTimer()
 | 
					bool RTVAllowed()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						if(!g_RTVAllowed)
 | 
				
			||||||
 | 
							return false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int time;
 | 
						int time;
 | 
				
			||||||
	if(GetMapTimeLeft(time) && time > 0)
 | 
						if(g_Cvar_RTVAutoDisable.BoolValue && GetMapTimeLeft(time) && time == 0)
 | 
				
			||||||
	{
 | 
							return false;
 | 
				
			||||||
		if(g_TimeOverTimer != INVALID_HANDLE)
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			KillTimer(g_TimeOverTimer);
 | 
					 | 
				
			||||||
			g_TimeOverTimer = INVALID_HANDLE;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		g_TimeOverTimer = CreateTimer(float(time), Timer_MapOver, _, TIMER_FLAG_NO_MAPCHANGE);
 | 
						return true;
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public Action Timer_MapOver(Handle timer)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	g_TimeOverTimer = INVALID_HANDLE;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if(g_Cvar_RTVAutoDisable.BoolValue)
 | 
					 | 
				
			||||||
		g_RTVAllowed = false;
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user