Skip to content

Commit d67014a

Browse files
authored
PrintToServer only if Log Cvar is set to 0 (#1)
* PrintToServer only if Log Cvar is set to 0 * Fix small mistake from author
1 parent 3735c8e commit d67014a

File tree

1 file changed

+25
-13
lines changed

1 file changed

+25
-13
lines changed

addons/sourcemod/scripting/FixSprayExploit.sp

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919

2020

21-
#define PLUGIN_VERSION "2.13"
21+
#define PLUGIN_VERSION "2.14"
2222

2323
/*=======================================================================================
2424
Plugin Info:
@@ -31,6 +31,8 @@
3131
3232
========================================================================================
3333
Change Log:
34+
2.14 (26-Aug-2022)
35+
- PrintToServer only if Log Cvar is set to 0.
3436
3537
2.13 (22-May-2022)
3638
- More detailed "LogAction" when kicking or banning clients.
@@ -483,15 +485,19 @@ public Action PlayerDecal(const char[] te_name, const int[] Players, int numClie
483485

484486
if( FileExists(g_sFilename) )
485487
{
486-
if( g_hCvarLog.IntValue ) LogCustom("Blocked invalid spray: %s from (%N) [%s]", g_sFilename, client, auth);
487-
PrintToServer("Blocked invalid spray: %s from (%N) [%s]", g_sFilename, client, auth);
488+
if( g_hCvarLog.IntValue >= 1)
489+
LogCustom("Blocked invalid spray: %s from (%N) [%s]", g_sFilename, client, auth);
490+
else
491+
PrintToServer("Blocked invalid spray: %s from (%N) [%s]", g_sFilename, client, auth);
488492

489493
TestClient(client);
490494
}
491495
else
492496
{
493-
if( g_hCvarLog.IntValue ) LogCustom("Blocked unchecked spray - missing file: %s from (%N) [%s]", g_sFilename, client, auth);
494-
PrintToServer("Blocked unchecked spray - missing file: %s from (%N) [%s]", g_sFilename, client, auth);
497+
if( g_hCvarLog.IntValue >= 1)
498+
LogCustom("Blocked unchecked spray - missing file: %s from (%N) [%s]", g_sFilename, client, auth);
499+
else
500+
PrintToServer("Blocked unchecked spray - missing file: %s from (%N) [%s]", g_sFilename, client, auth);
495501
}
496502

497503
float vPos[3];
@@ -600,7 +606,7 @@ public Action OnFileReceive(int client, const char[] sFile)
600606
{
601607
strcopy(g_sFilename, sizeof(g_sFilename), sFile);
602608

603-
if( g_hCvarLog.IntValue == 1 )
609+
if( g_hCvarLog.IntValue >= 1 )
604610
{
605611
client = GetClientFromSpray();
606612
if( !client ) client = GetClientFromJingle();
@@ -664,11 +670,15 @@ void FileCheck()
664670
{
665671
char auth[20];
666672
GetClientAuthId(client, AuthId_Steam2, auth, sizeof(auth));
667-
if( g_hCvarLog.IntValue ) LogCustom("Invalid spray: %s from (%N) [%s]", g_sFilename, client, auth);
668-
PrintToServer("Invalid spray: %s: %02d (%02X <> %02X) from (%N) [%s]", g_sFilename, i, iRead[i], g_iVal[i], client, auth);
673+
if( g_hCvarLog.IntValue >= 1)
674+
LogCustom("Invalid spray: %s from (%N) [%s]", g_sFilename, client, auth);
675+
else
676+
PrintToServer("Invalid spray: %s: %02d (%02X <> %02X) from (%N) [%s]", g_sFilename, i, iRead[i], g_iVal[i], client, auth);
669677
} else {
670-
if( g_hCvarLog.IntValue ) LogCustom("Invalid spray: %s", g_sFilename);
671-
PrintToServer("Invalid spray: %s: %02d (%02X <> %02X)", g_sFilename, i, iRead[i], g_iVal[i]);
678+
if( g_hCvarLog.IntValue >= 1)
679+
LogCustom("Invalid spray: %s", g_sFilename);
680+
else
681+
PrintToServer("Invalid spray: %s: %02d (%02X <> %02X)", g_sFilename, i, iRead[i], g_iVal[i]);
672682
}
673683

674684
TestClient(client);
@@ -679,8 +689,10 @@ void FileCheck()
679689

680690
ConfigFile(true);
681691
} else {
682-
if( g_hCvarLog.IntValue ) LogCustom("Missing file: %s", g_sFilename);
683-
PrintToServer("[Sprays] Missing file: %s", g_sFilename);
692+
if( g_hCvarLog.IntValue >= 1)
693+
LogCustom("Missing file: %s", g_sFilename);
694+
else
695+
PrintToServer("[Sprays] Missing file: %s", g_sFilename);
684696
}
685697
}
686698
}
@@ -787,4 +799,4 @@ void LogCustom(const char[] format, any ...)
787799
file.WriteLine("%s: %s", sTime, buffer);
788800
FlushFile(file);
789801
delete file;
790-
}
802+
}

0 commit comments

Comments
 (0)