plugins/mapchooser.sp
changeset 1861 cc6c6ed7615d
parent 1719 c9d5e55f0899
child 1862 2220462e2237
     1.1 --- a/plugins/mapchooser.sp	Wed Jan 23 17:06:33 2008 +0000
     1.2 +++ b/plugins/mapchooser.sp	Sat Jan 26 19:54:15 2008 +0000
     1.3 @@ -53,11 +53,8 @@
     1.4  new Handle:g_Cvar_StartTime = INVALID_HANDLE;
     1.5  new Handle:g_Cvar_StartRounds = INVALID_HANDLE;
     1.6  new Handle:g_Cvar_StartFrags = INVALID_HANDLE;
     1.7 -new Handle:g_Cvar_ExtendTimeMax = INVALID_HANDLE;
     1.8  new Handle:g_Cvar_ExtendTimeStep = INVALID_HANDLE;
     1.9 -new Handle:g_Cvar_ExtendRoundMax = INVALID_HANDLE;
    1.10  new Handle:g_Cvar_ExtendRoundStep = INVALID_HANDLE;
    1.11 -new Handle:g_Cvar_ExtendFragMax = INVALID_HANDLE;
    1.12  new Handle:g_Cvar_ExtendFragStep = INVALID_HANDLE;
    1.13  new Handle:g_Cvar_Mapfile = INVALID_HANDLE;
    1.14  new Handle:g_Cvar_ExcludeMaps = INVALID_HANDLE;
    1.15 @@ -74,6 +71,7 @@
    1.16  new Handle:g_TeamScores = INVALID_HANDLE;
    1.17  new Handle:g_VoteMenu = INVALID_HANDLE;
    1.18  
    1.19 +new g_Extends;
    1.20  new g_TotalRounds;
    1.21  new bool:g_HasVoteStarted;
    1.22  new g_mapFileTime;
    1.23 @@ -92,17 +90,14 @@
    1.24  	g_Cvar_StartTime = CreateConVar("sm_mapvote_start", "3.0", "Specifies when to start the vote based on time remaining.", _, true, 1.0);
    1.25  	g_Cvar_StartRounds = CreateConVar("sm_mapvote_startround", "2.0", "Specifies when to start the vote based on rounds remaining.", _, true, 1.0);
    1.26  	g_Cvar_StartFrags = CreateConVar("sm_mapvote_startfrags", "5.0", "Specifies when to start the vote base on frags remaining.", _, true, 1.0);
    1.27 -	g_Cvar_ExtendTimeMax = CreateConVar("sm_extendmap_maxtime", "90", "Specifies the maximum amount of time a map can be extended", _, true, 0.0);
    1.28  	g_Cvar_ExtendTimeStep = CreateConVar("sm_extendmap_timestep", "15", "Specifies how much many more minutes each extension makes", _, true, 5.0);
    1.29 -	g_Cvar_ExtendRoundMax = CreateConVar("sm_extendmap_maxrounds", "30", "Specfies the maximum amount of rounds a map can be extended", _, true, 0.0);
    1.30  	g_Cvar_ExtendRoundStep = CreateConVar("sm_extendmap_roundstep", "5", "Specifies how many more rounds each extension makes", _, true, 5.0);
    1.31 -	g_Cvar_ExtendFragMax = CreateConVar("sm_extendmap_maxfrags", "150", "Specfies the maximum frags allowed that a map can be extended.", _, true, 0.0);
    1.32  	g_Cvar_ExtendFragStep = CreateConVar("sm_extendmap_fragstep", "10", "Specifies how many more frags are allowed when map is extended.", _, true, 5.0);	
    1.33  	g_Cvar_Mapfile = CreateConVar("sm_mapvote_file", "configs/maps.ini", "Map file to use. (Def sourcemod/configs/maps.ini)");
    1.34  	g_Cvar_ExcludeMaps = CreateConVar("sm_mapvote_exclude", "5", "Specifies how many past maps to exclude from the vote.", _, true, 0.0);
    1.35  	g_Cvar_IncludeMaps = CreateConVar("sm_mapvote_include", "5", "Specifies how many maps to include in the vote.", _, true, 2.0, true, 6.0);
    1.36  	g_Cvar_NoVoteMode = CreateConVar("sm_mapvote_novote", "1", "Specifies whether or not MapChooser should pick a map if no votes are received.", _, true, 0.0, true, 1.0);
    1.37 -	g_Cvar_Extend = CreateConVar("sm_mapvote_extend", "1", "Specifies whether or not MapChooser will allow the map to be extended.", _, true, 0.0, true, 1.0);
    1.38 +	g_Cvar_Extend = CreateConVar("sm_mapvote_extend", "0", "Number of extensions allowed each map.", _, true, 0.0);
    1.39  
    1.40  	RegAdminCmd("sm_mapvote", Command_Mapvote, ADMFLAG_CHANGEMAP, "sm_mapvote - Forces MapChooser to attempt to run a map vote now.");
    1.41  
    1.42 @@ -147,6 +142,8 @@
    1.43  	
    1.44  	g_TeamScores = CreateArray(2);
    1.45  	g_TotalRounds = 0;
    1.46 +	
    1.47 +	g_Extends = 0;
    1.48  }
    1.49  
    1.50  public OnMapEnd()
    1.51 @@ -334,33 +331,9 @@
    1.52  		AddMenuItem(g_VoteMenu, map, map);
    1.53  	}
    1.54  
    1.55 -	if (GetConVarBool(g_Cvar_Extend))
    1.56 +	if (GetConVarBool(g_Cvar_Extend) && g_Extends < GetConVarInt(g_Cvar_Extend))
    1.57  	{
    1.58 -		new bool:allowExtend, time;
    1.59 -		if (GetMapTimeLimit(time) && time > 0 && time < GetConVarInt(g_Cvar_ExtendTimeMax))
    1.60 -		{
    1.61 -			allowExtend = true;
    1.62 -		}
    1.63 -
    1.64 -		if (g_Cvar_Winlimit != INVALID_HANDLE && GetConVarInt(g_Cvar_Winlimit) < GetConVarInt(g_Cvar_ExtendRoundMax))
    1.65 -		{
    1.66 -			allowExtend = true;
    1.67 -		}	
    1.68 -	
    1.69 -		if (g_Cvar_Maxrounds != INVALID_HANDLE && GetConVarInt(g_Cvar_Maxrounds) < GetConVarInt(g_Cvar_ExtendRoundMax))
    1.70 -		{
    1.71 -			allowExtend = true;
    1.72 -		}
    1.73 -	
    1.74 -		if (g_Cvar_Fraglimit != INVALID_HANDLE && GetConVarInt(g_Cvar_Fraglimit) < GetConVarInt(g_Cvar_ExtendFragMax))
    1.75 -		{
    1.76 -			allowExtend = true;
    1.77 -		}
    1.78 -
    1.79 -		if (allowExtend)
    1.80 -		{
    1.81 -			AddMenuItem(g_VoteMenu, VOTE_EXTEND, "Extend Map");
    1.82 -		}
    1.83 +		AddMenuItem(g_VoteMenu, VOTE_EXTEND, "Extend Map");
    1.84  	}
    1.85  
    1.86  	SetMenuExitButton(g_VoteMenu, false);
    1.87 @@ -445,6 +418,8 @@
    1.88  
    1.89  			if (strcmp(map, VOTE_EXTEND, false) == 0)
    1.90  			{
    1.91 +				g_Extends++;
    1.92 +				
    1.93  				new time;
    1.94  				if (GetMapTimeLimit(time))
    1.95  				{