Skip to content

Commit c4dd324

Browse files
authored
Ffeat: bump to 2.22 (#4)
1 parent 74feef8 commit c4dd324

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

addons/sourcemod/scripting/FixSprayExploit.sp

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

1919

2020

21-
#define PLUGIN_VERSION "2.20"
21+
#define PLUGIN_VERSION "2.22"
2222

2323
/*=======================================================================================
2424
Plugin Info:
@@ -32,6 +32,12 @@
3232
========================================================================================
3333
Change Log:
3434
35+
2.22 (15-Feb-2023)
36+
- Now prevents even more log spamming duplicate entries. Thanks to ".Rushaway" for reporting.
37+
38+
2.21 (22-Jan-2023)
39+
- Now prevents even more log spamming duplicate entries. Thanks to ".Rushaway" for reporting.
40+
3541
2.20 (20-Jan-2023)
3642
- Now logs if a Steam ID is unverified.
3743
- Now prevents log spamming duplicate entries.
@@ -165,6 +171,7 @@
165171

166172

167173
#define MAX_READ 50
174+
#define TIMEOUT_LOG 5.0
168175
#define PATH_BACKUP "backup_sprays"
169176

170177
int g_iVal[] = {86,84,70,0,7,0,0,0,42,0,0,0,42,0,0,0,42,42,42,42,42,42,42,42,42,42,42,0,0,0,0,0,0,0,0,0};
@@ -173,6 +180,7 @@ char g_sMoveFiles[PLATFORM_MAX_PATH];
173180
char g_sDownloads[PLATFORM_MAX_PATH];
174181
char g_sPath1[MAXPLAYERS+1][PLATFORM_MAX_PATH];
175182
char g_sPath2[MAXPLAYERS+1][PLATFORM_MAX_PATH];
183+
float g_fSprayed[MAXPLAYERS+1];
176184
ConVar g_hCvarBan, g_hCvarKick, g_hCvarLog, g_hCvarMsg, g_hCvarPath;
177185
EngineVersion g_iEngine;
178186
StringMap g_smChecked;
@@ -304,6 +312,7 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
304312

305313
public void OnClientConnected(int client)
306314
{
315+
g_fSprayed[client] = 0.0;
307316
g_sPath1[client][0] = 0;
308317
g_sPath2[client][0] = 0;
309318
}
@@ -391,6 +400,11 @@ public void OnMapEnd()
391400
MoveSprays();
392401
g_smReceive.Clear();
393402
g_smWaiting.Clear();
403+
404+
for( int i = 1; i <= MaxClients; i++ )
405+
{
406+
g_fSprayed[i] = 0.0;
407+
}
394408
}
395409

396410
void ConVarChanged_Cvars(Handle convar, const char[] oldValue, const char[] newValue)
@@ -729,15 +743,20 @@ Action PlayerDecal(const char[] te_name, const int[] Players, int numClients, fl
729743

730744
if( FileExists(g_sFilename) )
731745
{
732-
if( g_hCvarLog.IntValue ) LogCustom("Blocked invalid spray: %s from (%N) [%s]", g_sFilename, client, auth);
733-
if( g_hCvarMsg.IntValue ) PrintToServer("[Spray Exploit] Blocked invalid spray: %s from (%N) [%s]", g_sFilename, client, auth);
746+
if( GetGameTime() - g_fSprayed[client] > TIMEOUT_LOG )
747+
{
748+
g_fSprayed[client] = GetGameTime();
749+
if( g_hCvarLog.IntValue ) LogCustom("Blocked invalid spray: %s from (%N) [%s]", g_sFilename, client, auth);
750+
if( g_hCvarMsg.IntValue ) PrintToServer("[Spray Exploit] Blocked invalid spray: %s from (%N) [%s]", g_sFilename, client, auth);
751+
}
734752

735753
TestClient(client);
736754
}
737755
else
738756
{
739-
if( !g_smWaiting.GetValue(auth, val) )
757+
if( GetGameTime() - g_fSprayed[client] > TIMEOUT_LOG && !g_smWaiting.GetValue(auth, val) )
740758
{
759+
g_fSprayed[client] = GetGameTime();
741760
g_smWaiting.SetValue(auth, true);
742761
if( g_hCvarLog.IntValue ) LogCustom("Blocked unchecked spray - missing file: %s from (%N) [%s]", g_sFilename, client, auth);
743762
if( g_hCvarMsg.IntValue == 1 ) PrintToServer("[Spray Exploit] Blocked unchecked spray - missing file: %s from (%N) [%s]", g_sFilename, client, auth);
@@ -950,7 +969,7 @@ void FileCheck()
950969
if( !client ) client = GetClientFromJingle();
951970
if( client )
952971
{
953-
char auth[32];
972+
static char auth[32];
954973
GetClientAuthId(client, AuthId_Steam2, auth, sizeof(auth));
955974
if( strncmp(auth[6], "ID_", 3) == 0 )
956975
{

0 commit comments

Comments
 (0)