Pending Map should no longer be shown when mapvotes are disabled.

Removed tf2 include from mapchooser.
Moved sm_setnextmap to mapchooser and made it block the end of map vote.

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%402427
This commit is contained in:
Matt Woodrow 2008-07-28 07:47:28 +00:00
parent 50eb77926e
commit ae7e5a6a4b
4 changed files with 72 additions and 47 deletions

View File

@ -36,9 +36,6 @@
#include <sourcemod>
#include <mapchooser>
#include <nextmap>
#undef REQUIRE_EXTENSIONS
#include <tf2>
#define REQUIRE_EXTENSIONS
public Plugin:myinfo =
{
@ -104,6 +101,7 @@ new g_winCount[MAXTEAMS];
public OnPluginStart()
{
LoadTranslations("mapchooser.phrases");
LoadTranslations("common.phrases");
new arraySize = ByteCountToCells(33);
g_MapList = CreateArray(arraySize);
@ -113,7 +111,6 @@ public OnPluginStart()
g_NextMapList = CreateArray(arraySize);
g_Cvar_EndOfMapVote = CreateConVar("sm_mapvote_endvote", "1", "Specifies if MapChooser should run an end of map vote", _, true, 0.0, true, 1.0);
HookConVarChange(g_Cvar_EndOfMapVote, EndVoteChanged);
g_Cvar_StartTime = CreateConVar("sm_mapvote_start", "3.0", "Specifies when to start the vote based on time remaining.", _, true, 1.0);
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);
@ -127,7 +124,9 @@ public OnPluginStart()
g_Cvar_Extend = CreateConVar("sm_mapvote_extend", "0", "Number of extensions allowed each map.", _, true, 0.0);
g_Cvar_DontChange = CreateConVar("sm_mapvote_dontchange", "1", "Specifies if a 'Don't Change' option should be added to early votes", _, true, 0.0);
g_Cvar_VoteDuration = CreateConVar("sm_mapvote_voteduration", "20", "Specifies how long the mapvote should be available for.", _, true, 5.0, true, 25.0);
RegAdminCmd("sm_mapvote", Command_Mapvote, ADMFLAG_CHANGEMAP, "sm_mapvote - Forces MapChooser to attempt to run a map vote now.");
RegAdminCmd("sm_setnextmap", Command_SetNextmap, ADMFLAG_CHANGEMAP, "sm_setnextmap <map>");
g_Cvar_Winlimit = FindConVar("mp_winlimit");
g_Cvar_Maxrounds = FindConVar("mp_maxrounds");
@ -155,8 +154,6 @@ public OnPluginStart()
SetConVarBounds(g_Cvar_Bonusroundtime, ConVarBound_Upper, true, 30.0);
}
g_NominationsResetForward = CreateGlobalForward("OnNominationRemoved", ET_Ignore, Param_String, Param_Cell);
}
@ -256,16 +253,30 @@ public OnClientDisconnect(client)
g_NominateCount--;
}
public EndVoteChanged(Handle:convar, const String:oldValue[], const String:newValue[])
public Action:Command_SetNextmap(client, args)
{
if (newValue[0] == '1')
if (args < 1)
{
SetNextMap("Pending Vote");
ReplyToCommand(client, "[SM] Usage: sm_setnextmap <map>");
return Plugin_Handled;
}
else
decl String:map[64];
GetCmdArg(1, map, sizeof(map));
if (!IsMapValid(map))
{
SetNextMap("");
ReplyToCommand(client, "[SM] %t", "Map was not found", map);
return Plugin_Handled;
}
ShowActivity(client, "%t", "Changed Next Map", map);
LogMessage("\"%L\" changed nextmap to \"%s\"", client, map);
SetNextMap(map);
g_MapVoteCompleted = true;
return Plugin_Handled;
}
public OnMapTimeLeftChanged()
@ -346,11 +357,11 @@ public Event_TeamPlayWinPanel(Handle:event, const String:name[], bool:dontBroadc
{
switch(GetEventInt(event, "winning_team"))
{
case TFTeam_Blue:
case 3:
{
CheckWinLimit(bluescore);
}
case TFTeam_Red:
case 2:
{
CheckWinLimit(redscore);
}
@ -920,6 +931,11 @@ public Native_CanVoteStart(Handle:plugin, numParams)
public Native_CheckVoteDone(Handle:plugin, numParams)
{
if (GetConVarBool(g_Cvar_EndOfMapVote) == false)
{
return true;
}
return g_MapVoteCompleted;
}

View File

@ -59,7 +59,6 @@ public OnPluginStart()
g_MapList = CreateArray(32);
RegAdminCmd("sm_setnextmap", Command_SetNextmap, ADMFLAG_CHANGEMAP, "sm_setnextmap <map>");
RegAdminCmd("sm_maphistory", Command_MapHistory, ADMFLAG_CHANGEMAP, "Shows the most recent maps played");
RegConsoleCmd("listmaps", Command_List);
@ -89,31 +88,6 @@ public OnConfigsExecuted()
}
}
public Action:Command_SetNextmap(client, args)
{
if (args < 1)
{
ReplyToCommand(client, "[SM] Usage: sm_setnextmap <map>");
return Plugin_Handled;
}
decl String:map[64];
GetCmdArg(1, map, sizeof(map));
if (!IsMapValid(map))
{
ReplyToCommand(client, "[SM] %t", "Map was not found", map);
return Plugin_Handled;
}
ShowActivity(client, "%t", "Changed Next Map", map);
LogMessage("\"%L\" changed nextmap to \"%s\"", client, map);
SetNextMap(map);
return Plugin_Handled;
}
public Action:Command_List(client, args)
{
PrintToConsole(client, "Map Cycle:");
@ -214,18 +188,18 @@ FormatTimeDuration(String:buffer[], maxlen, time)
if (days > 0)
{
Format(buffer, maxlen, "%id %ih %im", days, hours, (seconds >= 30) ? minutes+1 : minutes);
return Format(buffer, maxlen, "%id %ih %im", days, hours, (seconds >= 30) ? minutes+1 : minutes);
}
else if (hours > 0)
{
Format(buffer, maxlen, "%ih %im", hours, (seconds >= 30) ? minutes+1 : minutes);
return Format(buffer, maxlen, "%ih %im", hours, (seconds >= 30) ? minutes+1 : minutes);
}
else if (minutes > 0)
{
Format(buffer, maxlen, "%im", (seconds >= 30) ? minutes+1 : minutes);
return Format(buffer, maxlen, "%im", (seconds >= 30) ? minutes+1 : minutes);
}
else
{
Format(buffer, maxlen, "%is", seconds);
return Format(buffer, maxlen, "%is", seconds);
}
}
}

View File

@ -37,4 +37,10 @@
"#format" "{1:i},{2:i}"
"en" "Current map continues! The Vote has spoken! (Received {1}%% of {2} votes)"
}
"Changed Next Map"
{
"#format" "{1:s}"
"en" "Changed nextmap to \"{1}\"."
}
}

View File

@ -1,8 +1,37 @@
"Phrases"
{
"Changed Next Map"
"Map History"
{
"#format" "{1:s}"
"en" "Changed nextmap to \"{1}\"."
"en" "Map History"
}
"Map"
{
"en" "[Map]"
}
"Started"
{
"en" "[Started]"
}
"Played Time"
{
"en" "[Played Time]"
}
"Reason"
{
"en" "[Reason for ending]"
}
"Current Map"
{
"en" "Current Map"
}
"ago"
{
"en" "ago"
}
}