Skip to content

Commit a904cc2

Browse files
authored
chore: bump to 2.24 (#7)
1 parent 8d535c8 commit a904cc2

File tree

1 file changed

+55
-23
lines changed

1 file changed

+55
-23
lines changed

addons/sourcemod/scripting/FixSprayExploit.sp

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

1919

2020

21-
#define PLUGIN_VERSION "2.23"
21+
#define PLUGIN_VERSION "2.24"
2222

2323
/*=======================================================================================
2424
Plugin Info:
@@ -31,6 +31,9 @@
3131
3232
========================================================================================
3333
Change Log:
34+
2.24 (17-Jul-2023)
35+
- Now less check of GetClientAuthId by storing them. Thanks to ".Rushaway".
36+
3437
2.23 (01-Apr-2023)
3538
- Now only TestClient depending cvar
3639
- Now ban lenght can be adjusted via cvar
@@ -183,6 +186,8 @@ char g_sMoveFiles[PLATFORM_MAX_PATH];
183186
char g_sDownloads[PLATFORM_MAX_PATH];
184187
char g_sPath1[MAXPLAYERS+1][PLATFORM_MAX_PATH];
185188
char g_sPath2[MAXPLAYERS+1][PLATFORM_MAX_PATH];
189+
char g_sAuth[MAXPLAYERS+1][64];
190+
char g_sAuthUnverified[MAXPLAYERS+1][64];
186191
float g_fSprayed[MAXPLAYERS+1];
187192
ConVar g_hCvarBan, g_hCvarBanTime, g_hCvarKick, g_hCvarLog, g_hCvarMsg, g_hCvarPath, g_hCvarPunish;
188193
EngineVersion g_iEngine;
@@ -315,6 +320,17 @@ public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3
315320
return Plugin_Continue;
316321
}
317322

323+
public void OnClientPutInServer(int client)
324+
{
325+
char sSteamID[64];
326+
GetClientAuthId(client, AuthId_Steam2, sSteamID, sizeof(sSteamID));
327+
FormatEx(g_sAuth[client], sizeof(g_sAuth[]), "%s", sSteamID);
328+
329+
char sSteamIDUnverified[32];
330+
GetClientAuthId(client, AuthId_Steam2, sSteamIDUnverified, sizeof(sSteamIDUnverified), false);
331+
FormatEx(g_sAuthUnverified[client], sizeof(g_sAuthUnverified[]), "%s", sSteamIDUnverified);
332+
}
333+
318334
public void OnClientConnected(int client)
319335
{
320336
g_fSprayed[client] = 0.0;
@@ -324,19 +340,23 @@ public void OnClientConnected(int client)
324340

325341
public void OnClientDisconnect(int client)
326342
{
327-
if( IsFakeClient(client) ) return;
328-
329-
if( IsClientConnected(client) )
343+
if( !IsFakeClient(client) )
330344
{
331-
static char auth[32];
332-
GetClientAuthId(client, AuthId_Steam2, auth, sizeof(auth), false);
333-
g_smWaiting.Remove(auth);
345+
if( IsClientConnected(client) )
346+
{
347+
//static char auth[32];
348+
//GetClientAuthId(client, AuthId_Steam2, auth, sizeof(auth), false);
349+
g_smWaiting.Remove(g_sAuthUnverified[client]);
350+
}
351+
352+
g_smChecked.Remove(g_sPath1[client]);
353+
g_smReceive.Remove(g_sPath1[client]);
354+
g_smChecked.Remove(g_sPath2[client]);
355+
g_smReceive.Remove(g_sPath2[client]);
334356
}
335357

336-
g_smChecked.Remove(g_sPath1[client]);
337-
g_smReceive.Remove(g_sPath1[client]);
338-
g_smChecked.Remove(g_sPath2[client]);
339-
g_smReceive.Remove(g_sPath2[client]);
358+
FormatEx(g_sAuth[client], sizeof(g_sAuth[]), "");
359+
FormatEx(g_sAuthUnverified[client], sizeof(g_sAuthUnverified[]), "");
340360

341361
/*
342362
static char sPath[PLATFORM_MAX_PATH];
@@ -739,11 +759,15 @@ Action PlayerDecal(const char[] te_name, const int[] Players, int numClients, fl
739759
if( !val )
740760
{
741761
static char auth[64];
742-
GetClientAuthId(client, AuthId_Steam2, auth, sizeof(auth));
743-
if ( auth[6] == 'I' )
762+
//GetClientAuthId(client, AuthId_Steam2, auth, sizeof(auth));
763+
if ( g_sAuth[client][6] == 'I' )
744764
{
745-
GetClientAuthId(client, AuthId_Steam2, auth, sizeof(auth), false);
746-
Format(auth, sizeof(auth), "Unverified: %s", auth);
765+
//GetClientAuthId(client, AuthId_Steam2, auth, sizeof(auth), false);
766+
Format(auth, sizeof(auth), "Unverified: %s", g_sAuthUnverified[client]);
767+
}
768+
else
769+
{
770+
Format(auth, sizeof(auth), "%s", g_sAuth[client]);
747771
}
748772

749773
if( FileExists(g_sFilename) )
@@ -907,11 +931,15 @@ public Action OnFileReceive(int client, const char[] sFile)
907931
if( client )
908932
{
909933
static char auth[64];
910-
GetClientAuthId(client, AuthId_Steam2, auth, sizeof(auth));
911-
if ( auth[6] == 'I' )
934+
//GetClientAuthId(client, AuthId_Steam2, auth, sizeof(auth));
935+
if ( g_sAuth[client][6] == 'I' )
936+
{
937+
//GetClientAuthId(client, AuthId_Steam2, auth, sizeof(auth), false);
938+
Format(auth, sizeof(auth), "Unverified: %s", g_sAuthUnverified[client]);
939+
}
940+
else
912941
{
913-
GetClientAuthId(client, AuthId_Steam2, auth, sizeof(auth), false);
914-
Format(auth, sizeof(auth), "Unverified: %s", auth);
942+
Format(auth, sizeof(auth), "%s", g_sAuth[client]);
915943
}
916944

917945
LogCustom("File received: %s from (%N) [%s]", sFile, client, auth);
@@ -973,11 +1001,15 @@ void FileCheck()
9731001
if( client )
9741002
{
9751003
static char auth[64];
976-
GetClientAuthId(client, AuthId_Steam2, auth, sizeof(auth));
977-
if ( auth[6] == 'I' )
1004+
//GetClientAuthId(client, AuthId_Steam2, auth, sizeof(auth));
1005+
if ( g_sAuth[client][6] == 'I' )
1006+
{
1007+
//GetClientAuthId(client, AuthId_Steam2, auth, sizeof(auth), false);
1008+
Format(auth, sizeof(auth), "Unverified: %s", g_sAuthUnverified[client]);
1009+
}
1010+
else
9781011
{
979-
GetClientAuthId(client, AuthId_Steam2, auth, sizeof(auth), false);
980-
Format(auth, sizeof(auth), "Unverified: %s", auth);
1012+
Format(auth, sizeof(auth), "%s", g_sAuth[client]);
9811013
}
9821014

9831015
if( g_hCvarLog.IntValue ) LogCustom("Invalid spray: %s from (%N) [%s]", g_sFilename, client, auth);

0 commit comments

Comments
 (0)