Add ChatFilter2, OverheadChat, EventGreeting and update several plugins
New plugins: ChatFilter2, OverheadChat, EventGreeting. Updated: HostnameManager, Leader3 (chat and markers), NameFilter2 (plugin and config), PlayerRankings_nohlstats (rank display modes), custom-chatcolors (plugin and ccc.inc), Extend (sm_settimeleft). Add shared includes the plugins build against: Break, ChatFilter2, Couch, EventNotifier, TransmitManager, leader, ripext, unloze_playtime.
This commit is contained in:
@@ -87,6 +87,7 @@ public void OnPluginStart()
|
||||
{
|
||||
RegAdminCmd("sm_extendmap", Command_Extend, ADMFLAG_GENERIC, "Add more time to mp_timelimit");
|
||||
RegAdminCmd("sm_extend", Command_ExtendVote, ADMFLAG_GENERIC, "sm_extend [time] - Start an extendvote");
|
||||
RegAdminCmd("sm_settimeleft", Command_SetTimeLeft, ADMFLAG_GENERIC, "sm_settimeleft <minutes> - Set the time left on the map");
|
||||
|
||||
// Relies on the m_fRoundStartTime gamerules prop, which only Counter-Strike games have
|
||||
EngineVersion engine = GetEngineVersion();
|
||||
@@ -229,6 +230,53 @@ public Action Command_ExtendVote(int client, int argc)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action Command_SetTimeLeft(int client, int argc)
|
||||
{
|
||||
if (argc < 1)
|
||||
{
|
||||
ReplyToCommand(client, "[SM] Usage: sm_settimeleft <minutes>");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
char sArgs[16];
|
||||
GetCmdArg(1, sArgs, sizeof(sArgs));
|
||||
|
||||
int iTargetMinutes;
|
||||
if (!StringToIntEx(sArgs, iTargetMinutes) || iTargetMinutes < 1)
|
||||
{
|
||||
ReplyToCommand(client, "[SM] Invalid value, minutes must be 1 or more");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
int iOldLimit = g_cvarMpTimeLimit.IntValue;
|
||||
int iTimeLeft;
|
||||
if (iOldLimit <= 0 || !GetMapTimeLeft(iTimeLeft) || iTimeLeft == -1)
|
||||
{
|
||||
ReplyToCommand(client, "[SM] There is no time limit on this map, set mp_timelimit instead");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
// mp_timelimit counts from map start, so add the time already played.
|
||||
// It only holds whole minutes, so the result is within 30 seconds of the target.
|
||||
int iElapsed = iOldLimit * 60 - iTimeLeft;
|
||||
int iNewLimit = RoundToNearest(float(iElapsed + iTargetMinutes * 60) / 60.0);
|
||||
if (iNewLimit < 1)
|
||||
iNewLimit = 1;
|
||||
|
||||
g_cvarMpTimeLimit.IntValue = iNewLimit;
|
||||
if (iNewLimit > iOldLimit)
|
||||
CancelGameOver();
|
||||
|
||||
int iNewTimeLeft = iNewLimit * 60 - iElapsed;
|
||||
if (iNewTimeLeft < 0)
|
||||
iNewTimeLeft = 0;
|
||||
|
||||
LogAction(client, -1, "\"%L\" set the time left to \"%d\" minutes (mp_timelimit %d -> %d)", client, iTargetMinutes, iOldLimit, iNewLimit);
|
||||
PrintToChatAll("[SM] %N set the time left to %d:%02d.", client, iNewTimeLeft / 60, iNewTimeLeft % 60);
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public Action Command_RoundExtend(int client, int argc)
|
||||
{
|
||||
float fElapsedTime = (GetGameTime() - GameRules_GetPropFloat("m_fRoundStartTime")) / 60.0;
|
||||
|
||||
Reference in New Issue
Block a user