r5sdk/r5dev/engine/sys_dll2.cpp
Kawe Mazidjatari 34b779735e Don't allow server to execute 'disconnect' on client
Removed extraneous 'FCVAR_SERVER_CAN_EXECUTE' flag. We disconnect clients using 'CClient::Disconnect(..)', relying on the client is useless without an anti-cheat and anti-tamper. Client can still use this to disconnect on its own though.

'migrateme' seemed useless as well, removed 'FCVAR_SERVER_CAN_EXECUTE'.

This makes all 'FCVAR_SERVER_CAN_EXECUTE' require 'FCVAR_DEVELOPMENTONLY' to be stripped, in order to execute without the '-devsdk' parameter (development launch arg),
2022-09-17 20:43:16 +02:00

71 lines
2.3 KiB
C++

//===== Copyright © 1996-2005, Valve Corporation, All rights reserved. ======//
//
// Purpose:
//
// $NoKeywords: $
//===========================================================================//
#include "core/stdafx.h"
#include "tier1/cmd.h"
#include "tier1/cvar.h"
#include "tier1/strtools.h"
#include "engine/sys_dll.h"
#include "engine/sys_dll2.h"
#ifndef DEDICATED
#include "client/vengineclient_impl.h"
#endif // !DEDICATED
//-----------------------------------------------------------------------------
// Figure out if we're running a Valve mod or not.
//-----------------------------------------------------------------------------
static bool IsValveMod(const char* pModName)
{
return (Q_stricmp(pModName, "cstrike") == 0 ||
Q_stricmp(pModName, "dod") == 0 ||
Q_stricmp(pModName, "hl1mp") == 0 ||
Q_stricmp(pModName, "tf") == 0 ||
Q_stricmp(pModName, "hl2mp") == 0 ||
Q_stricmp(pModName, "csgo") == 0);
}
//-----------------------------------------------------------------------------
// Figure out if we're running a Respawn mod or not.
//-----------------------------------------------------------------------------
static bool IsRespawnMod(const char* pModName)
{
return (Q_stricmp(pModName, "r1") == 0 ||
Q_stricmp(pModName, "r2") == 0 ||
Q_stricmp(pModName, "r5") == 0);
}
//-----------------------------------------------------------------------------
// Initialization, shutdown of a mod.
//-----------------------------------------------------------------------------
bool CEngineAPI::ModInit(CEngineAPI* pEngineAPI, const char* pModName, const char* pGameDir)
{
g_pConCommand->InitShipped();
g_pConCommand->PurgeShipped();
g_pConVar->InitShipped();
g_pConVar->PurgeShipped();
bool results = CEngineAPI_ModInit(pEngineAPI, pModName, pGameDir);
if (!IsValveMod(pModName) && !IsRespawnMod(pModName))
{
#ifndef DEDICATED
g_pEngineClient->SetRestrictServerCommands(true); // Restrict server commands.
g_pEngineClient->SetRestrictClientCommands(true); // Restrict client commands.
#endif // !DEDICATED
}
return results;
}
///////////////////////////////////////////////////////////////////////////////
void SysDll2_Attach()
{
DetourAttach((LPVOID*)&CEngineAPI_ModInit, &CEngineAPI::ModInit);
}
void SysDll2_Detach()
{
DetourDetach((LPVOID*)&CEngineAPI_ModInit, &CEngineAPI::ModInit);
}