Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 38 additions & 10 deletions autorecorder.sp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
* [*] Fixed minimum player count setting being off by one
* [*] Fixed player counting code getting out of range
* [*] Updated source code to the new syntax
* Apr 15, 2022 - v.1.3.1:
* [*] Increased the length limit of the map name in the demo filename
* [*] Fixed workshop map demo filenames missing the .dem extension
* Jun 05, 2022 - v.1.3.2:
* [*] Handled tv_record not resolving relative paths including "."
*
*/

Expand All @@ -33,7 +38,7 @@
#pragma semicolon 1
#pragma newdecls required

#define PLUGIN_VERSION "1.3.0"
#define PLUGIN_VERSION "1.3.2"

public Plugin myinfo =
{
Expand Down Expand Up @@ -77,10 +82,7 @@ public void OnPluginStart()

char sPath[PLATFORM_MAX_PATH];
g_hDemoPath.GetString(sPath, sizeof(sPath));
if(!DirExists(sPath))
{
InitDirectory(sPath);
}
OnConVarChanged(g_hDemoPath, sPath, sPath);

g_hMinPlayersStart.AddChangeHook(OnConVarChanged);
g_hIgnoreBots.AddChangeHook(OnConVarChanged);
Expand All @@ -98,9 +100,23 @@ public void OnConVarChanged(ConVar convar, const char[] oldValue, const char []
{
if(convar == g_hDemoPath)
{
if(!DirExists(newValue))
// Handle tv_record not resolving relative paths including "."
char demoPath[PLATFORM_MAX_PATH];
g_hDemoPath.GetString(demoPath, sizeof(demoPath));
if (StrEqual(demoPath, "."))
{
demoPath = "";
}
ReplaceString(demoPath, sizeof(demoPath), "./", "");
g_hDemoPath.SetString(demoPath);
if (StrEqual(demoPath, ""))
{
InitDirectory(newValue);
return;
}

if(!DirExists(demoPath))
{
InitDirectory(demoPath);
}
}
else
Expand Down Expand Up @@ -222,16 +238,28 @@ void StartRecord()
{
char sPath[PLATFORM_MAX_PATH];
char sTime[16];
char sMap[32];
char sMap[48];

g_hDemoPath.GetString(sPath, sizeof(sPath));
FormatTime(sTime, sizeof(sTime), "%Y%m%d-%H%M%S", GetTime());
GetCurrentMap(sMap, sizeof(sMap));

// replace slashes in map path name with dashes, to prevent fail on workshop maps
ReplaceString(sMap, sizeof(sMap), "/", "-", false);
ReplaceString(sMap, sizeof(sMap), "/", "-", false);
// replace periods in map path name with underscores, so workshop map demos still get a .dem extension
ReplaceString(sMap, sizeof(sMap), ".", "_", false);

ServerCommand("tv_record \"%s/auto-%s-%s\"", sPath, sTime, sMap);
if (StrEqual(sPath, ""))
{
ServerCommand("tv_record \"auto-%s-%s\"", sTime, sMap);
}
else
{
char demoFilename[72];
Format(demoFilename, sizeof(demoFilename), "%s/auto-%s-%s", sPath, sTime, sMap);
ReplaceString(demoFilename, sizeof(demoFilename), "//", "/", false);
ServerCommand("tv_record \"%s\"", demoFilename);
}
g_bIsRecording = true;

LogMessage("Recording to auto-%s-%s.dem", sTime, sMap);
Expand Down
2 changes: 1 addition & 1 deletion nextmap_poplimits.sp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
*/

#include <sourcemod>
#include "include/nextmap.inc"
#include "nextmap.inc"

#pragma semicolon 1
#pragma newdecls required
Expand Down
Binary file added plugins/afkicker.smx
Binary file not shown.
Binary file added plugins/autorecorder.smx
Binary file not shown.
Binary file added plugins/inschat.smx
Binary file not shown.
Binary file added plugins/jail.smx
Binary file not shown.
Binary file added plugins/mapstats.smx
Binary file not shown.
Binary file added plugins/nextmap_poplimits.smx
Binary file not shown.
Binary file added plugins/nmrihstats.smx
Binary file not shown.
Binary file added plugins/qpdis.smx
Binary file not shown.
Binary file added plugins/setheads.smx
Binary file not shown.
Binary file added plugins/shipchat.smx
Binary file not shown.
Binary file added plugins/teambalancer.smx
Binary file not shown.
Binary file added plugins/teamswap.smx
Binary file not shown.
Binary file added plugins/tkmanager.smx
Binary file not shown.
Binary file added plugins/whitelist.smx
Binary file not shown.