plugins/mapchooser.sp
changeset 2215 bcbfee080d08
parent 2203 159ab9bad58c
child 2223 a912c065719f
     1.1 --- a/plugins/mapchooser.sp	Sun Jul 27 06:29:58 2008 +0000
     1.2 +++ b/plugins/mapchooser.sp	Mon Jul 28 07:47:28 2008 +0000
     1.3 @@ -36,9 +36,6 @@
     1.4  #include <sourcemod>
     1.5  #include <mapchooser>
     1.6  #include <nextmap>
     1.7 -#undef REQUIRE_EXTENSIONS
     1.8 -#include <tf2>
     1.9 -#define REQUIRE_EXTENSIONS
    1.10  
    1.11  public Plugin:myinfo =
    1.12  {
    1.13 @@ -104,6 +101,7 @@
    1.14  public OnPluginStart()
    1.15  {
    1.16  	LoadTranslations("mapchooser.phrases");
    1.17 +	LoadTranslations("common.phrases");
    1.18  	
    1.19  	new arraySize = ByteCountToCells(33);
    1.20  	g_MapList = CreateArray(arraySize);
    1.21 @@ -113,7 +111,6 @@
    1.22  	g_NextMapList = CreateArray(arraySize);
    1.23  	
    1.24  	g_Cvar_EndOfMapVote = CreateConVar("sm_mapvote_endvote", "1", "Specifies if MapChooser should run an end of map vote", _, true, 0.0, true, 1.0);
    1.25 -	HookConVarChange(g_Cvar_EndOfMapVote, EndVoteChanged);
    1.26  
    1.27  	g_Cvar_StartTime = CreateConVar("sm_mapvote_start", "3.0", "Specifies when to start the vote based on time remaining.", _, true, 1.0);
    1.28  	g_Cvar_StartRounds = CreateConVar("sm_mapvote_startround", "2.0", "Specifies when to start the vote based on rounds remaining. Use 0 on TF2 to start vote during bonus round time", _, true, 0.0);
    1.29 @@ -127,7 +124,9 @@
    1.30  	g_Cvar_Extend = CreateConVar("sm_mapvote_extend", "0", "Number of extensions allowed each map.", _, true, 0.0);
    1.31  	g_Cvar_DontChange = CreateConVar("sm_mapvote_dontchange", "1", "Specifies if a 'Don't Change' option should be added to early votes", _, true, 0.0);
    1.32  	g_Cvar_VoteDuration = CreateConVar("sm_mapvote_voteduration", "20", "Specifies how long the mapvote should be available for.", _, true, 5.0, true, 25.0);
    1.33 +	
    1.34  	RegAdminCmd("sm_mapvote", Command_Mapvote, ADMFLAG_CHANGEMAP, "sm_mapvote - Forces MapChooser to attempt to run a map vote now.");
    1.35 +	RegAdminCmd("sm_setnextmap", Command_SetNextmap, ADMFLAG_CHANGEMAP, "sm_setnextmap <map>");
    1.36  
    1.37  	g_Cvar_Winlimit = FindConVar("mp_winlimit");
    1.38  	g_Cvar_Maxrounds = FindConVar("mp_maxrounds");
    1.39 @@ -155,8 +154,6 @@
    1.40  		SetConVarBounds(g_Cvar_Bonusroundtime, ConVarBound_Upper, true, 30.0);		
    1.41  	}
    1.42  	
    1.43 -
    1.44 -	
    1.45  	g_NominationsResetForward = CreateGlobalForward("OnNominationRemoved", ET_Ignore, Param_String, Param_Cell);
    1.46  }
    1.47  
    1.48 @@ -256,16 +253,30 @@
    1.49  	g_NominateCount--;
    1.50  }
    1.51  
    1.52 -public EndVoteChanged(Handle:convar, const String:oldValue[], const String:newValue[])
    1.53 +public Action:Command_SetNextmap(client, args)
    1.54  {
    1.55 -	if (newValue[0] == '1')
    1.56 +	if (args < 1)
    1.57  	{
    1.58 -		SetNextMap("Pending Vote");
    1.59 +		ReplyToCommand(client, "[SM] Usage: sm_setnextmap <map>");
    1.60 +		return Plugin_Handled;
    1.61  	}
    1.62 -	else
    1.63 +
    1.64 +	decl String:map[64];
    1.65 +	GetCmdArg(1, map, sizeof(map));
    1.66 +
    1.67 +	if (!IsMapValid(map))
    1.68  	{
    1.69 -		SetNextMap("");	
    1.70 +		ReplyToCommand(client, "[SM] %t", "Map was not found", map);
    1.71 +		return Plugin_Handled;
    1.72  	}
    1.73 +
    1.74 +	ShowActivity(client, "%t", "Changed Next Map", map);
    1.75 +	LogMessage("\"%L\" changed nextmap to \"%s\"", client, map);
    1.76 +
    1.77 +	SetNextMap(map);
    1.78 +	g_MapVoteCompleted = true;
    1.79 +
    1.80 +	return Plugin_Handled;
    1.81  }
    1.82  
    1.83  public OnMapTimeLeftChanged()
    1.84 @@ -346,11 +357,11 @@
    1.85  	{	
    1.86  		switch(GetEventInt(event, "winning_team"))
    1.87  		{
    1.88 -			case TFTeam_Blue:
    1.89 +			case 3:
    1.90  			{
    1.91  				CheckWinLimit(bluescore);
    1.92  			}
    1.93 -			case TFTeam_Red:
    1.94 +			case 2:
    1.95  			{
    1.96  				CheckWinLimit(redscore);				
    1.97  			}			
    1.98 @@ -920,6 +931,11 @@
    1.99  
   1.100  public Native_CheckVoteDone(Handle:plugin, numParams)
   1.101  {
   1.102 +	if (GetConVarBool(g_Cvar_EndOfMapVote) == false)
   1.103 +	{
   1.104 +		return true;	
   1.105 +	}
   1.106 +	
   1.107  	return g_MapVoteCompleted;
   1.108  }
   1.109