Skip to content

Commit

Permalink
fix issue with discordapi spam printing (??)
Browse files Browse the repository at this point in the history
  • Loading branch information
sapphonie committed Nov 30, 2023
1 parent a89815c commit bc850fb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
6 changes: 1 addition & 5 deletions scripting/stac/stac_mapchange.sp
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,7 @@ void ResetTimers()
QueryTimer[cl] =
CreateTimer
(
GetRandomFloat
(
stac_min_randomcheck_secs.FloatValue,
stac_max_randomcheck_secs.FloatValue
),
float_rand( stac_min_randomcheck_secs.FloatValue, stac_max_randomcheck_secs.FloatValue ),
Timer_CheckClientConVars,
userid
);
Expand Down
11 changes: 9 additions & 2 deletions scripting/stac/stac_stocks.sp
Original file line number Diff line number Diff line change
Expand Up @@ -706,6 +706,15 @@ public void OnLibraryAdded(const char[] name)
// otherwise, it's a detection with a number of detections
void StacNotify(int userid, const char[] prefmtedstring, int detections = 0)
{
// This prevents a strange race condition where StAC seems to explode using ban
// systems that don't ban immediately, resulting in a ridiculous amount of discord spam.
// I'm still investigating, so this may not fully fix the issue.
int cl = GetClientOfUserId(userid);
if (userBanQueued[cl])
{
return;
}

StacLogDemo();

if (!DISCORD)
Expand Down Expand Up @@ -746,8 +755,6 @@ void StacNotify(int userid, const char[] prefmtedstring, int detections = 0)
// this isn't used anywhere we're just using it to copy off of
json_cleanup_and_delete(spacerField);

int cl = GetClientOfUserId(userid);

JSON_Object nameField;
JSON_Object steamIDfield;
if (userid)
Expand Down

0 comments on commit bc850fb

Please sign in to comment.