Skip to content

Commit 69c8dbb

Browse files
authored
feat(cvars): conditionally enable logs (#12)
1 parent 1c464cd commit 69c8dbb

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

product.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.19.0
1+
1.19.1

src/extension.cpp

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ ConVar *g_SvForceCTSpawn = CreateConVar("sv_cssfixes_force_ct_spawnpoints", "1",
194194
ConVar *g_SvSkipCashReset = CreateConVar("sv_cssfixes_skip_cash_reset", "1", FCVAR_NOTIFY, "Skip reset cash to 16000 when buying an item");
195195
ConVar *g_SvGameEndUnFreeze = CreateConVar("sv_cssfixes_gameend_unfreeze", "1", FCVAR_NOTIFY, "Allow people to run around freely after game end");
196196
ConVar *g_SvAlwaysTransmitPointViewControl = CreateConVar("sv_cssfixes_always_transmit_point_viewcontrol", "0", FCVAR_NOTIFY, "Always transmit point_viewcontrol for debugging purposes");
197+
ConVar *g_SvLogs = CreateConVar("sv_cssfixes_logs", "0", FCVAR_NOTIFY, "Add extra logs of action performed");
197198

198199
std::vector<SrcdsPatch> gs_Patches = {};
199200

@@ -259,7 +260,10 @@ DETOUR_DECL_MEMBER1(DETOUR_PostConstructor, void, const char *, szClassname)
259260
// Only CT spawnpoints
260261
if(g_SvForceCTSpawn->GetInt() && strcasecmp(szClassname, "info_player_terrorist") == 0)
261262
{
262-
g_pSM->LogMessage(myself, "Forcing CT spawn");
263+
if (g_SvLogs->GetInt())
264+
{
265+
g_pSM->LogMessage(myself, "Forcing CT spawn");
266+
}
263267
szClassname = "info_player_counterterrorist";
264268
}
265269

@@ -360,7 +364,10 @@ DETOUR_DECL_MEMBER2(DETOUR_KeyValue, bool, const char *, szKeyName, const char *
360364
strcasecmp(szKeyName, "classname") == 0 &&
361365
strcasecmp(szValue, "info_player_terrorist") == 0)
362366
{
363-
g_pSM->LogMessage(myself, "Forcing CT spawn");
367+
if (g_SvLogs->GetInt())
368+
{
369+
g_pSM->LogMessage(myself, "Forcing CT spawn");
370+
}
364371

365372
// Only CT spawnpoints
366373
szValue = "info_player_counterterrorist";
@@ -369,7 +376,10 @@ DETOUR_DECL_MEMBER2(DETOUR_KeyValue, bool, const char *, szKeyName, const char *
369376
{
370377
const char *pClassname = gamehelpers->GetEntityClassname(pEntity);
371378

372-
g_pSM->LogMessage(myself, "Forcing CT buyzone");
379+
if (g_SvLogs->GetInt())
380+
{
381+
g_pSM->LogMessage(myself, "Forcing CT buyzone");
382+
}
373383

374384
// All buyzones should be CT buyzones
375385
if(pClassname && strcasecmp(pClassname, "func_buyzone") == 0)
@@ -813,7 +823,10 @@ bool CSSFixes::SDK_OnLoad(char *error, size_t maxlength, bool late)
813823
"cstrike/bin/server_srv.so"
814824
});
815825

816-
g_pSM->LogMessage(myself, "Forcing CT spawn");
826+
if (g_SvLogs->GetInt())
827+
{
828+
g_pSM->LogMessage(myself, "Forcing CT spawn");
829+
}
817830
}
818831

819832
if (g_SvSkipCashReset->GetInt())

0 commit comments

Comments
 (0)