TF2 Round count mapchooser fix.
authorMatt Woodrow <pred@alliedmods.net>
Fri Apr 25 05:26:39 2008 +0000 (2008-04-25)
changeset 2027887d7271f947
parent 2026 03b4a9c4a70e
child 2028 0b36b8bfe5ab
TF2 Round count mapchooser fix.
plugins/mapmanager.sp
     1.1 --- a/plugins/mapmanager.sp	Fri Apr 25 05:20:17 2008 +0000
     1.2 +++ b/plugins/mapmanager.sp	Fri Apr 25 05:26:39 2008 +0000
     1.3 @@ -34,6 +34,8 @@
     1.4  
     1.5  #pragma semicolon 1
     1.6  #include <sourcemod>
     1.7 +#undef REQUIRE_PLUGIN
     1.8 +#include <adminmenu>
     1.9  
    1.10  public Plugin:myinfo =
    1.11  {
    1.12 @@ -44,13 +46,14 @@
    1.13  	url = "http://www.sourcemod.net/"
    1.14  };
    1.15  
    1.16 -#include "mapmanagement/globals.sp"
    1.17 -#include "mapmanagement/commands.sp"
    1.18 -#include "mapmanagement/events.sp"
    1.19 -#include "mapmanagement/functions.sp"
    1.20 -#include "mapmanagement/menus.sp"
    1.21 -#include "mapmanagement/timers.sp"
    1.22 -#include "mapmanagement/votes.sp"
    1.23 +#include "mapmanager/globals.sp"
    1.24 +#include "mapmanager/commands.sp"
    1.25 +#include "mapmanager/events.sp"
    1.26 +#include "mapmanager/functions.sp"
    1.27 +#include "mapmanager/functions_menu.sp"
    1.28 +#include "mapmanager/menus.sp"
    1.29 +#include "mapmanager/timers.sp"
    1.30 +#include "mapmanager/votes.sp"
    1.31  
    1.32  public OnPluginStart()
    1.33  {	
    1.34 @@ -85,7 +88,7 @@
    1.35  	RegAdminCmd("sm_setnextmap", Command_SetNextmap, ADMFLAG_CHANGEMAP, "sm_setnextmap <map>");
    1.36  	RegAdminCmd("sm_votemap", Command_Votemap, ADMFLAG_VOTE|ADMFLAG_CHANGEMAP, "sm_votemap <mapname> [mapname2] ... [mapname5] ");
    1.37  	RegAdminCmd("sm_maplist", Command_List, ADMFLAG_GENERIC, "sm_maplist");
    1.38 -	RegAdminCmd("sm_nominate", Command_Addmap, ADMFLAG_CHANGEMAP, "sm_nominate <mapname> - Nominates a map for RockTheVote and MapChooser. Overrides existing nominations.");
    1.39 +	RegAdminCmd("sm_nominate", Command_Nominate, ADMFLAG_CHANGEMAP, "sm_nominate <mapname> - Nominates a map for RockTheVote and MapChooser. Overrides existing nominations.");
    1.40  	RegAdminCmd("sm_mapvote", Command_Mapvote, ADMFLAG_CHANGEMAP, "sm_mapvote - Forces the MapChooser vote to occur.");
    1.41  	
    1.42  	if (GetCommandFlags("nextmap") == INVALID_FCVAR_FLAGS)
    1.43 @@ -94,7 +97,7 @@
    1.44  	}	
    1.45  	
    1.46  	// Register all convars
    1.47 -	g_Cvar_Nextmap = CreateConVar("sm_nextmap", "", "Sets the Next Map", FCVAR_NOTIFY);
    1.48 +	g_Cvar_NextMap = CreateConVar("sm_nextmap", "", "Sets the Next Map", FCVAR_NOTIFY);
    1.49  	
    1.50  	g_Cvar_MapCount = CreateConVar("sm_mm_maps", "4", "Number of maps to be voted on at end of map or RTV. 2 to 6. (Def 4)", 0, true, 2.0, true, 6.0);	
    1.51  	g_Cvar_Excludes = CreateConVar("sm_mm_exclude", "5", "Specifies how many past maps to exclude from end of map vote and RTV.", _, true, 0.0);
    1.52 @@ -123,6 +126,7 @@
    1.53  	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.54  	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.55  	
    1.56 +	
    1.57  	// Find game convars
    1.58  	g_Cvar_Chattime = FindConVar("mp_chattime");
    1.59  	g_Cvar_Winlimit = FindConVar("mp_winlimit");
    1.60 @@ -144,7 +148,7 @@
    1.61  	// Set to the current map so OnMapStart() will know what to do
    1.62  	decl String:currentMap[64];
    1.63  	GetCurrentMap(currentMap, 64);
    1.64 -	SetNextmap(currentMap);	
    1.65 +	SetNextMap(currentMap);	
    1.66  
    1.67  	// Create necessary menus for TopMenu
    1.68  	g_Menu_Map = CreateMenu(MenuHandler_Map);
    1.69 @@ -223,7 +227,7 @@
    1.70  	
    1.71  	// Get the current and last maps.
    1.72  	decl String:lastMap[64], String:currentMap[64];
    1.73 -	GetConVarString(g_Cvar_Nextmap, lastMap, 64);
    1.74 +	GetConVarString(g_Cvar_NextMap, lastMap, 64);
    1.75  	GetCurrentMap(currentMap, 64);
    1.76  	
    1.77  	// Why am I doing this? If we switched to a new map, but it wasn't what we expected (Due to sm_map, sm_votemap, or
    1.78 @@ -235,8 +239,10 @@
    1.79  	}
    1.80  	
    1.81  	// Build map menus for sm_map, sm_votemap, and RTV.
    1.82 -	BuildMapMenu(g_Menu_Map, list);
    1.83 -	BuildMapMenu(g_Menu_VoteMap, list);
    1.84 +	/* TODO: Figure out wtf I'm supposed to do here */
    1.85 +	BuildMapMenu(g_Menu_Map);
    1.86 +	BuildMapMenu(g_Menu_Votemap);
    1.87 +
    1.88  	
    1.89  	// If the Randomize option is on, randomize!
    1.90  	if (GetConVarBool(g_Cvar_Randomize))
    1.91 @@ -248,23 +254,25 @@
    1.92  	if (GetConVarBool(g_Cvar_MapChooser))
    1.93  	{
    1.94  		SetupTimeleftTimer();
    1.95 -		SetConVarString(g_Cvar_Nextmap, "Pending Vote");
    1.96 +		SetConVarString(g_Cvar_NextMap, "Pending Vote");
    1.97  	}
    1.98  	
    1.99 +	/*
   1.100  	// If RockTheVote is active, start it up!
   1.101  	if (GetConVarBool(g_Cvar_RockTheVote))
   1.102  	{
   1.103  		BuildMapMenu(g_Menu_RTV, list);
   1.104  		CreateTimer(30.0, Timer_DelayRTV);
   1.105 -	}	
   1.106 +	}
   1.107 +	*/
   1.108  }
   1.109  
   1.110  // Reinitialize all our various globals
   1.111  public OnMapStart()
   1.112  {
   1.113 -	if (g_Nominate != INVALID_HANDLE)
   1.114 +	if (g_Menu_Nominate != INVALID_HANDLE)
   1.115  	{
   1.116 -		ClearArray(g_Nominate);
   1.117 +		ClearArray(g_Menu_Nominate);
   1.118  	}
   1.119  	
   1.120  	if (g_TeamScores != INVALID_HANDLE)
   1.121 @@ -314,7 +322,7 @@
   1.122  	{
   1.123  		g_RTV_Voted[client] = false;
   1.124  		g_RTV_Voters++;
   1.125 -		g_RTV_VotesNeeded = RoundToFloor(float(g_Voters) * GetConVarFloat(g_Cvar_Needed));
   1.126 +		g_RTV_VotesNeeded = RoundToFloor(float(g_RTV_Voters) * GetConVarFloat(g_Cvar_RTVLimit));
   1.127  	}
   1.128  
   1.129  	// If Nominate is active, let the new client nominate