2016-03-01 02:19:19 +01:00
|
|
|
//#undef REQUIRE_EXTENSIONS
|
2016-02-29 09:59:09 +01:00
|
|
|
#include "sourcetvmanager"
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public void OnPluginStart()
|
2016-02-29 09:59:09 +01:00
|
|
|
{
|
2016-03-01 02:19:19 +01:00
|
|
|
LoadTranslations("common.phrases");
|
|
|
|
|
2016-02-29 09:59:09 +01:00
|
|
|
RegConsoleCmd("sm_servercount", Cmd_GetServerCount);
|
|
|
|
RegConsoleCmd("sm_selectserver", Cmd_SelectServer);
|
2016-03-02 23:23:53 +01:00
|
|
|
RegConsoleCmd("sm_selectedserver", Cmd_GetSelectedServer);
|
2016-03-03 12:28:49 +01:00
|
|
|
RegConsoleCmd("sm_ismaster", Cmd_IsMasterProxy);
|
|
|
|
RegConsoleCmd("sm_serverip", Cmd_GetServerIP);
|
|
|
|
RegConsoleCmd("sm_serverport", Cmd_GetServerPort);
|
2016-03-02 23:23:53 +01:00
|
|
|
RegConsoleCmd("sm_botindex", Cmd_GetBotIndex);
|
|
|
|
RegConsoleCmd("sm_broadcasttick", Cmd_GetBroadcastTick);
|
2016-02-29 09:59:09 +01:00
|
|
|
RegConsoleCmd("sm_localstats", Cmd_Localstats);
|
2016-03-02 23:23:53 +01:00
|
|
|
RegConsoleCmd("sm_globalstats", Cmd_Globalstats);
|
2016-02-29 09:59:09 +01:00
|
|
|
RegConsoleCmd("sm_getdelay", Cmd_GetDelay);
|
|
|
|
RegConsoleCmd("sm_spectators", Cmd_Spectators);
|
|
|
|
RegConsoleCmd("sm_spechintmsg", Cmd_SendHintMessage);
|
2016-03-03 04:13:21 +01:00
|
|
|
RegConsoleCmd("sm_specchat", Cmd_SendChatMessage);
|
|
|
|
RegConsoleCmd("sm_specchatlocal", Cmd_SendChatMessageLocal);
|
2016-11-14 10:09:03 +01:00
|
|
|
RegConsoleCmd("sm_specconsole", Cmd_SendMessage);
|
2016-03-02 23:23:53 +01:00
|
|
|
RegConsoleCmd("sm_viewentity", Cmd_GetViewEntity);
|
|
|
|
RegConsoleCmd("sm_vieworigin", Cmd_GetViewOrigin);
|
2016-03-01 02:19:19 +01:00
|
|
|
RegConsoleCmd("sm_forcechasecam", Cmd_ForceChaseCameraShot);
|
|
|
|
//RegConsoleCmd("sm_forcefixedcam", Cmd_ForceFixedCameraShot);
|
2016-02-29 09:59:09 +01:00
|
|
|
RegConsoleCmd("sm_startrecording", Cmd_StartRecording);
|
|
|
|
RegConsoleCmd("sm_stoprecording", Cmd_StopRecording);
|
|
|
|
RegConsoleCmd("sm_isrecording", Cmd_IsRecording);
|
|
|
|
RegConsoleCmd("sm_demofile", Cmd_GetDemoFileName);
|
|
|
|
RegConsoleCmd("sm_recordtick", Cmd_GetRecordTick);
|
|
|
|
RegConsoleCmd("sm_specstatus", Cmd_SpecStatus);
|
|
|
|
RegConsoleCmd("sm_democonsole", Cmd_PrintDemoConsole);
|
|
|
|
RegConsoleCmd("sm_botcmd", Cmd_ExecuteStringCommand);
|
|
|
|
RegConsoleCmd("sm_speckick", Cmd_KickClient);
|
2016-11-14 10:01:44 +01:00
|
|
|
RegConsoleCmd("sm_specchatone", Cmd_PrintToChat);
|
2016-11-14 10:09:03 +01:00
|
|
|
RegConsoleCmd("sm_specconsoleone", Cmd_PrintToConsole);
|
2016-11-14 10:27:38 +01:00
|
|
|
RegConsoleCmd("sm_spectitle", Cmd_SetTVTitle);
|
2016-02-29 09:59:09 +01:00
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public void SourceTV_OnStartRecording(int instance, const char[] filename)
|
2016-02-29 09:59:09 +01:00
|
|
|
{
|
2016-03-01 15:00:27 +01:00
|
|
|
PrintToServer("Started recording sourcetv #%d demo to %s", instance, filename);
|
2016-02-29 09:59:09 +01:00
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public void SourceTV_OnStopRecording(int instance, const char[] filename, int recordingtick)
|
2016-02-29 09:59:09 +01:00
|
|
|
{
|
2016-03-01 15:00:27 +01:00
|
|
|
PrintToServer("Stopped recording sourcetv #%d demo to %s (%d ticks)", instance, filename, recordingtick);
|
2016-02-29 09:59:09 +01:00
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public bool SourceTV_OnSpectatorPreConnect(const char[] name, char password[255], const char[] ip, char rejectReason[255])
|
2016-03-02 23:23:53 +01:00
|
|
|
{
|
|
|
|
PrintToServer("SourceTV spectator is connecting! Name: %s, pw: %s, ip: %s", name, password, ip);
|
|
|
|
if (StrEqual(password, "nope", false))
|
|
|
|
{
|
|
|
|
strcopy(rejectReason, 255, "Heh, that password sucks.");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public void SourceTV_OnServerStart(int instance)
|
2016-03-06 12:16:38 +01:00
|
|
|
{
|
|
|
|
PrintToServer("SourceTV instance %d started.", instance);
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public void SourceTV_OnServerShutdown(int instance)
|
2016-03-06 12:16:38 +01:00
|
|
|
{
|
|
|
|
PrintToServer("SourceTV instance %d shutdown.", instance);
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public void SourceTV_OnSpectatorConnected(int client)
|
2016-03-02 23:23:53 +01:00
|
|
|
{
|
|
|
|
PrintToServer("SourceTV client %d connected. (isconnected %d)", client, SourceTV_IsClientConnected(client));
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public void SourceTV_OnSpectatorPutInServer(int client)
|
2016-03-03 07:23:49 +01:00
|
|
|
{
|
|
|
|
PrintToServer("SourceTV client %d put in server.", client);
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public void SourceTV_OnSpectatorDisconnect(int client, char reason[255])
|
2016-03-02 23:23:53 +01:00
|
|
|
{
|
|
|
|
PrintToServer("SourceTV client %d is disconnecting (isconnected %d) with reason -> %s.", client, SourceTV_IsClientConnected(client), reason);
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public void SourceTV_OnSpectatorDisconnected(int client, const char reason[255])
|
2016-03-02 23:23:53 +01:00
|
|
|
{
|
|
|
|
PrintToServer("SourceTV client %d disconnected (isconnected %d) with reason -> %s.", client, SourceTV_IsClientConnected(client), reason);
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action SourceTV_OnSpectatorChatMessage(int client, char message[255], char chatgroup[255])
|
2016-11-14 08:16:39 +01:00
|
|
|
{
|
|
|
|
PrintToServer("SourceTV client %d (chatgroup \"%s\") writes: %s", client, chatgroup, message);
|
|
|
|
return Plugin_Continue;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public void SourceTV_OnSpectatorChatMessage_Post(int client, const char[] message, const char[] chatgroup)
|
2016-11-14 08:16:39 +01:00
|
|
|
{
|
|
|
|
PrintToServer("SourceTV client %d (chatgroup \"%s\") wrote: %s", client, chatgroup, message);
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action Cmd_GetServerCount(int client, int args)
|
2016-02-29 09:59:09 +01:00
|
|
|
{
|
2016-03-01 15:00:27 +01:00
|
|
|
ReplyToCommand(client, "SourceTV server count: %d", SourceTV_GetServerInstanceCount());
|
2016-02-29 09:59:09 +01:00
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action Cmd_SelectServer(int client, int args)
|
2016-02-29 09:59:09 +01:00
|
|
|
{
|
|
|
|
if (args < 1)
|
|
|
|
{
|
|
|
|
ReplyToCommand(client, "Usage: sm_selectserver <instance id>");
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
char sArg[12];
|
2016-02-29 09:59:09 +01:00
|
|
|
GetCmdArg(1, sArg, sizeof(sArg));
|
2016-11-16 07:17:53 +01:00
|
|
|
int iInstance = StringToInt(sArg);
|
2016-02-29 09:59:09 +01:00
|
|
|
|
2016-03-01 15:00:27 +01:00
|
|
|
SourceTV_SelectServerInstance(iInstance);
|
2016-02-29 09:59:09 +01:00
|
|
|
ReplyToCommand(client, "SourceTV selecting server: %d", iInstance);
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action Cmd_GetSelectedServer(int client, int args)
|
2016-02-29 09:59:09 +01:00
|
|
|
{
|
2016-03-01 15:00:27 +01:00
|
|
|
ReplyToCommand(client, "SourceTV selected server: %d", SourceTV_GetSelectedServerInstance());
|
2016-02-29 09:59:09 +01:00
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action Cmd_IsMasterProxy(int client, int args)
|
2016-03-03 12:28:49 +01:00
|
|
|
{
|
|
|
|
ReplyToCommand(client, "SourceTV is master proxy: %d", SourceTV_IsMasterProxy());
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action Cmd_GetServerIP(int client, int args)
|
2016-03-03 12:28:49 +01:00
|
|
|
{
|
2016-11-16 07:17:53 +01:00
|
|
|
char sIP[32];
|
|
|
|
bool bSuccess = SourceTV_GetServerIP(sIP, sizeof(sIP));
|
2016-03-03 12:28:49 +01:00
|
|
|
ReplyToCommand(client, "SourceTV server ip (ret %d): %s", bSuccess, sIP);
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action Cmd_GetServerPort(int client, int args)
|
2016-03-03 12:28:49 +01:00
|
|
|
{
|
|
|
|
ReplyToCommand(client, "SourceTV server port: %d", SourceTV_GetServerPort());
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action Cmd_GetBotIndex(int client, int args)
|
2016-02-29 09:59:09 +01:00
|
|
|
{
|
|
|
|
ReplyToCommand(client, "SourceTV bot index: %d", SourceTV_GetBotIndex());
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action Cmd_GetBroadcastTick(int client, int args)
|
2016-03-01 02:19:19 +01:00
|
|
|
{
|
|
|
|
ReplyToCommand(client, "SourceTV broadcast tick: %d", SourceTV_GetBroadcastTick());
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action Cmd_Localstats(int client, int args)
|
2016-02-29 09:59:09 +01:00
|
|
|
{
|
2016-11-16 07:17:53 +01:00
|
|
|
int proxies, slots, specs;
|
2016-02-29 09:59:09 +01:00
|
|
|
if (!SourceTV_GetLocalStats(proxies, slots, specs))
|
|
|
|
{
|
|
|
|
ReplyToCommand(client, "SourceTV local stats: no server selected :(");
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
ReplyToCommand(client, "SourceTV local stats: proxies %d - slots %d - specs %d", proxies, slots, specs);
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action Cmd_Globalstats(int client, int args)
|
2016-03-02 23:23:53 +01:00
|
|
|
{
|
2016-11-16 07:17:53 +01:00
|
|
|
int proxies, slots, specs;
|
2016-03-02 23:23:53 +01:00
|
|
|
if (!SourceTV_GetGlobalStats(proxies, slots, specs))
|
|
|
|
{
|
|
|
|
ReplyToCommand(client, "SourceTV global stats: no server selected :(");
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
ReplyToCommand(client, "SourceTV global stats: proxies %d - slots %d - specs %d", proxies, slots, specs);
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action Cmd_GetDelay(int client, int args)
|
2016-02-29 09:59:09 +01:00
|
|
|
{
|
|
|
|
ReplyToCommand(client, "SourceTV delay: %f", SourceTV_GetDelay());
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action Cmd_Spectators(int client, int args)
|
2016-02-29 09:59:09 +01:00
|
|
|
{
|
|
|
|
ReplyToCommand(client, "SourceTV spectator count: %d/%d", SourceTV_GetSpectatorCount(), SourceTV_GetClientCount());
|
2016-11-16 07:17:53 +01:00
|
|
|
char sName[64], sIP[16], sPassword[256];
|
|
|
|
for (int i=1;i<=SourceTV_GetClientCount();i++)
|
2016-02-29 09:59:09 +01:00
|
|
|
{
|
|
|
|
if (!SourceTV_IsClientConnected(i))
|
|
|
|
continue;
|
|
|
|
|
2016-03-06 14:11:33 +01:00
|
|
|
SourceTV_GetClientName(i, sName, sizeof(sName));
|
|
|
|
SourceTV_GetClientIP(i, sIP, sizeof(sIP));
|
|
|
|
SourceTV_GetClientPassword(i, sPassword, sizeof(sPassword));
|
|
|
|
ReplyToCommand(client, "Client %d%s: %s - %s (password: %s)", i, (SourceTV_IsClientProxy(i)?" (RELAY)":""), sName, sIP, sPassword);
|
2016-02-29 09:59:09 +01:00
|
|
|
}
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action Cmd_SendHintMessage(int client, int args)
|
2016-02-29 09:59:09 +01:00
|
|
|
{
|
|
|
|
if (args < 1)
|
|
|
|
{
|
|
|
|
ReplyToCommand(client, "Usage: sm_spechintmsg <message>");
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
char sMsg[1024];
|
2016-02-29 09:59:09 +01:00
|
|
|
GetCmdArgString(sMsg, sizeof(sMsg));
|
|
|
|
StripQuotes(sMsg);
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
bool bSent = SourceTV_BroadcastScreenMessage(BTarget_Everyone, "%s", sMsg);
|
2016-02-29 09:59:09 +01:00
|
|
|
ReplyToCommand(client, "SourceTV sending hint message (success %d): %s", bSent, sMsg);
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action Cmd_SendMessage(int client, int args)
|
2016-02-29 09:59:09 +01:00
|
|
|
{
|
|
|
|
if (args < 1)
|
|
|
|
{
|
2016-11-14 10:09:03 +01:00
|
|
|
ReplyToCommand(client, "Usage: sm_specconsole <message>");
|
2016-02-29 09:59:09 +01:00
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
char sMsg[1024];
|
2016-02-29 09:59:09 +01:00
|
|
|
GetCmdArgString(sMsg, sizeof(sMsg));
|
|
|
|
StripQuotes(sMsg);
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
bool bSent = SourceTV_BroadcastConsoleMessage("%s", sMsg);
|
2016-02-29 09:59:09 +01:00
|
|
|
ReplyToCommand(client, "SourceTV sending console message (success %d): %s", bSent, sMsg);
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action Cmd_SendChatMessage(int client, int args)
|
2016-03-03 04:13:21 +01:00
|
|
|
{
|
|
|
|
if (args < 1)
|
|
|
|
{
|
|
|
|
ReplyToCommand(client, "Usage: sm_specchat <message>");
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
char sMsg[128];
|
2016-03-03 04:13:21 +01:00
|
|
|
GetCmdArgString(sMsg, sizeof(sMsg));
|
|
|
|
StripQuotes(sMsg);
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
bool bSent = SourceTV_BroadcastChatMessage(BTarget_Everyone, "%s", sMsg);
|
2016-03-03 04:13:21 +01:00
|
|
|
ReplyToCommand(client, "SourceTV sending chat message to all spectators (including relays) (success %d): %s", bSent, sMsg);
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action Cmd_SendChatMessageLocal(int client, int args)
|
2016-03-03 04:13:21 +01:00
|
|
|
{
|
|
|
|
if (args < 1)
|
|
|
|
{
|
|
|
|
ReplyToCommand(client, "Usage: sm_specchatlocal <message>");
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
char sMsg[128];
|
2016-03-03 04:13:21 +01:00
|
|
|
GetCmdArgString(sMsg, sizeof(sMsg));
|
|
|
|
StripQuotes(sMsg);
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
bool bSent = SourceTV_BroadcastChatMessage(BTarget_OnlyLocal, "%s", sMsg);
|
2016-03-03 04:13:21 +01:00
|
|
|
ReplyToCommand(client, "SourceTV sending chat message to local spectators (success %d): %s", bSent, sMsg);
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action Cmd_GetViewEntity(int client, int args)
|
2016-03-01 02:19:19 +01:00
|
|
|
{
|
|
|
|
ReplyToCommand(client, "SourceTV view entity: %d", SourceTV_GetViewEntity());
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action Cmd_GetViewOrigin(int client, int args)
|
2016-03-01 02:19:19 +01:00
|
|
|
{
|
2016-11-16 07:17:53 +01:00
|
|
|
float pos[3];
|
2016-03-01 02:19:19 +01:00
|
|
|
SourceTV_GetViewOrigin(pos);
|
|
|
|
ReplyToCommand(client, "SourceTV view origin: %f %f %f", pos[0], pos[1], pos[2]);
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action Cmd_ForceChaseCameraShot(int client, int args)
|
2016-03-01 02:19:19 +01:00
|
|
|
{
|
|
|
|
if (args < 1)
|
|
|
|
{
|
2016-03-01 15:00:27 +01:00
|
|
|
ReplyToCommand(client, "Usage: sm_forcechasecam <target> <ineye>");
|
2016-03-01 02:19:19 +01:00
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
char sTarget[PLATFORM_MAX_PATH];
|
2016-03-01 02:19:19 +01:00
|
|
|
GetCmdArg(1, sTarget, sizeof(sTarget));
|
|
|
|
StripQuotes(sTarget);
|
2016-11-16 07:17:53 +01:00
|
|
|
int iTarget = FindTarget(client, sTarget, false, false);
|
2016-03-01 02:19:19 +01:00
|
|
|
if (iTarget == -1)
|
|
|
|
return Plugin_Handled;
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
bool bInEye;
|
2016-03-01 02:19:19 +01:00
|
|
|
if (args >= 2)
|
|
|
|
{
|
2016-11-16 07:17:53 +01:00
|
|
|
char sInEye[16];
|
2016-03-01 02:19:19 +01:00
|
|
|
GetCmdArg(2, sInEye, sizeof(sInEye));
|
|
|
|
StripQuotes(sInEye);
|
|
|
|
bInEye = sInEye[0] == '1';
|
|
|
|
}
|
|
|
|
|
|
|
|
SourceTV_ForceChaseCameraShot(iTarget, 0, 96, -20, (GetRandomFloat()>0.5)?30:-30, bInEye, 20.0);
|
|
|
|
ReplyToCommand(client, "SourceTV forcing camera shot on %N.", iTarget);
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action Cmd_StartRecording(int client, int args)
|
2016-02-29 09:59:09 +01:00
|
|
|
{
|
|
|
|
if (args < 1)
|
|
|
|
{
|
|
|
|
ReplyToCommand(client, "Usage: sm_startrecording <filename>");
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
char sFilename[PLATFORM_MAX_PATH];
|
2016-02-29 09:59:09 +01:00
|
|
|
GetCmdArgString(sFilename, sizeof(sFilename));
|
|
|
|
StripQuotes(sFilename);
|
|
|
|
|
|
|
|
if (SourceTV_StartRecording(sFilename))
|
|
|
|
{
|
|
|
|
SourceTV_GetDemoFileName(sFilename, sizeof(sFilename));
|
|
|
|
ReplyToCommand(client, "SourceTV started recording to: %s", sFilename);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ReplyToCommand(client, "SourceTV failed to start recording to: %s", sFilename);
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action Cmd_StopRecording(int client, int args)
|
2016-02-29 09:59:09 +01:00
|
|
|
{
|
|
|
|
ReplyToCommand(client, "SourceTV stopped recording %d", SourceTV_StopRecording());
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action Cmd_IsRecording(int client, int args)
|
2016-02-29 09:59:09 +01:00
|
|
|
{
|
|
|
|
ReplyToCommand(client, "SourceTV is recording: %d", SourceTV_IsRecording());
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action Cmd_GetDemoFileName(int client, int args)
|
2016-02-29 09:59:09 +01:00
|
|
|
{
|
2016-11-16 07:17:53 +01:00
|
|
|
char sFileName[PLATFORM_MAX_PATH];
|
2016-02-29 09:59:09 +01:00
|
|
|
ReplyToCommand(client, "SourceTV demo file name (%d): %s", SourceTV_GetDemoFileName(sFileName, sizeof(sFileName)), sFileName);
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action Cmd_GetRecordTick(int client, int args)
|
2016-02-29 09:59:09 +01:00
|
|
|
{
|
|
|
|
ReplyToCommand(client, "SourceTV recording tick: %d", SourceTV_GetRecordingTick());
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action Cmd_SpecStatus(int client, int args)
|
2016-02-29 09:59:09 +01:00
|
|
|
{
|
2016-11-16 07:17:53 +01:00
|
|
|
int iSourceTV = SourceTV_GetBotIndex();
|
2016-02-29 09:59:09 +01:00
|
|
|
if (!iSourceTV)
|
|
|
|
return Plugin_Handled;
|
|
|
|
FakeClientCommand(iSourceTV, "status");
|
|
|
|
ReplyToCommand(client, "Sent status bot console.");
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action Cmd_PrintDemoConsole(int client, int args)
|
2016-02-29 09:59:09 +01:00
|
|
|
{
|
|
|
|
if (args < 1)
|
|
|
|
{
|
|
|
|
ReplyToCommand(client, "Usage: sm_democonsole <message>");
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
char sMsg[1024];
|
2016-02-29 09:59:09 +01:00
|
|
|
GetCmdArgString(sMsg, sizeof(sMsg));
|
|
|
|
StripQuotes(sMsg);
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
bool bSent = SourceTV_PrintToDemoConsole("%s", sMsg);
|
2016-02-29 09:59:09 +01:00
|
|
|
ReplyToCommand(client, "SourceTV printing to demo console (success %d): %s", bSent, sMsg);
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action Cmd_ExecuteStringCommand(int client, int args)
|
2016-02-29 09:59:09 +01:00
|
|
|
{
|
|
|
|
if (args < 1)
|
|
|
|
{
|
|
|
|
ReplyToCommand(client, "Usage: sm_botcmd <cmd>");
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
char sCmd[1024];
|
2016-02-29 09:59:09 +01:00
|
|
|
GetCmdArgString(sCmd, sizeof(sCmd));
|
|
|
|
StripQuotes(sCmd);
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
int iSourceTV = SourceTV_GetBotIndex();
|
2016-02-29 09:59:09 +01:00
|
|
|
if (!iSourceTV)
|
|
|
|
return Plugin_Handled;
|
|
|
|
FakeClientCommand(iSourceTV, sCmd);
|
|
|
|
ReplyToCommand(client, "SourceTV executing command on bot: %s", sCmd);
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action Cmd_KickClient(int client, int args)
|
2016-02-29 09:59:09 +01:00
|
|
|
{
|
2016-11-14 10:01:44 +01:00
|
|
|
if (args < 2)
|
2016-02-29 09:59:09 +01:00
|
|
|
{
|
|
|
|
ReplyToCommand(client, "Usage: sm_speckick <index> <reason>");
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
char sIndex[16], sMsg[1024];
|
2016-02-29 09:59:09 +01:00
|
|
|
GetCmdArg(1, sIndex, sizeof(sIndex));
|
|
|
|
StripQuotes(sIndex);
|
|
|
|
GetCmdArg(2, sMsg, sizeof(sMsg));
|
|
|
|
StripQuotes(sMsg);
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
int iTarget = StringToInt(sIndex);
|
2016-02-29 09:59:09 +01:00
|
|
|
SourceTV_KickClient(iTarget, sMsg);
|
|
|
|
ReplyToCommand(client, "SourceTV kicking spectator %d with reason %s", iTarget, sMsg);
|
|
|
|
return Plugin_Handled;
|
2016-11-14 10:01:44 +01:00
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action Cmd_PrintToChat(int client, int args)
|
2016-11-14 10:01:44 +01:00
|
|
|
{
|
|
|
|
if (args < 2)
|
|
|
|
{
|
|
|
|
ReplyToCommand(client, "Usage: sm_specchatone <index> <message>");
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
char sIndex[16], sMsg[1024];
|
2016-11-14 10:01:44 +01:00
|
|
|
GetCmdArg(1, sIndex, sizeof(sIndex));
|
|
|
|
StripQuotes(sIndex);
|
|
|
|
GetCmdArg(2, sMsg, sizeof(sMsg));
|
|
|
|
StripQuotes(sMsg);
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
int iTarget = StringToInt(sIndex);
|
2016-11-14 10:01:44 +01:00
|
|
|
SourceTV_PrintToChat(iTarget, "%s", sMsg);
|
|
|
|
ReplyToCommand(client, "SourceTV sending chat message to spectator %d: %s", iTarget, sMsg);
|
|
|
|
return Plugin_Handled;
|
2016-11-14 10:09:03 +01:00
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action Cmd_PrintToConsole(int client, int args)
|
2016-11-14 10:09:03 +01:00
|
|
|
{
|
|
|
|
if (args < 2)
|
|
|
|
{
|
|
|
|
ReplyToCommand(client, "Usage: sm_specconsoleone <index> <message>");
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
char sIndex[16], sMsg[1024];
|
2016-11-14 10:09:03 +01:00
|
|
|
GetCmdArg(1, sIndex, sizeof(sIndex));
|
|
|
|
StripQuotes(sIndex);
|
|
|
|
GetCmdArg(2, sMsg, sizeof(sMsg));
|
|
|
|
StripQuotes(sMsg);
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
int iTarget = StringToInt(sIndex);
|
2016-11-14 10:09:03 +01:00
|
|
|
SourceTV_PrintToConsole(iTarget, "%s", sMsg);
|
|
|
|
ReplyToCommand(client, "SourceTV sending console message to spectator %d: %s", iTarget, sMsg);
|
|
|
|
return Plugin_Handled;
|
2016-11-14 10:27:38 +01:00
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
public Action Cmd_SetTVTitle(int client, int args)
|
2016-11-14 10:27:38 +01:00
|
|
|
{
|
|
|
|
if (args < 2)
|
|
|
|
{
|
|
|
|
ReplyToCommand(client, "Usage: sm_spectitle <index> <title>");
|
|
|
|
return Plugin_Handled;
|
|
|
|
}
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
char sIndex[16], sMsg[1024];
|
2016-11-14 10:27:38 +01:00
|
|
|
GetCmdArg(1, sIndex, sizeof(sIndex));
|
|
|
|
StripQuotes(sIndex);
|
|
|
|
GetCmdArg(2, sMsg, sizeof(sMsg));
|
|
|
|
StripQuotes(sMsg);
|
|
|
|
|
2016-11-16 07:17:53 +01:00
|
|
|
int iTarget = StringToInt(sIndex);
|
2016-11-14 10:27:38 +01:00
|
|
|
SourceTV_SetClientTVTitle(iTarget, "%s", sMsg);
|
|
|
|
ReplyToCommand(client, "SourceTV set stream title of spectator %d to %s", iTarget, sMsg);
|
|
|
|
return Plugin_Handled;
|
2016-02-29 09:59:09 +01:00
|
|
|
}
|