From bc850fb7ad9052757a62be6784a12ca5b09676f4 Mon Sep 17 00:00:00 2001 From: stephanie sappho lenzo Date: Thu, 30 Nov 2023 03:10:12 -0500 Subject: [PATCH] fix issue with discordapi spam printing (??) --- scripting/stac/stac_mapchange.sp | 6 +----- scripting/stac/stac_stocks.sp | 11 +++++++++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/scripting/stac/stac_mapchange.sp b/scripting/stac/stac_mapchange.sp index ef14ed5..75dafd2 100755 --- a/scripting/stac/stac_mapchange.sp +++ b/scripting/stac/stac_mapchange.sp @@ -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 ); diff --git a/scripting/stac/stac_stocks.sp b/scripting/stac/stac_stocks.sp index 1759096..e4710bb 100755 --- a/scripting/stac/stac_stocks.sp +++ b/scripting/stac/stac_stocks.sp @@ -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) @@ -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)