Skip to content

Commit 7dd1d7e

Browse files
authored
Enhance spam detection and cookie menu title
Updated spam delay convar to allow disabling spam detection. Changed cookie menu title to use formatted string.
1 parent 78ede70 commit 7dd1d7e

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

addons/sourcemod/scripting/TriggerWatcher.sp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,14 @@ public void OnPluginStart()
6868
}
6969

7070
/* CONVARS */
71-
g_hCVar_SpamDelay = CreateConVar("sm_TriggerWatcher_block_spam_delay", "5", "Time to wait before notifying the next button press", FCVAR_NONE, true, 1.0, true, 60.0);
71+
g_hCVar_SpamDelay = CreateConVar("sm_TriggerWatcher_block_spam_delay", "5", "Time to wait before notifying the next button press (0 = disable spam detection)", FCVAR_NONE, true, 0.0, true, 60.0);
7272

7373
AutoExecConfig(true);
7474

7575
/* COOKIES */
76-
SetCookieMenuItem(CookieHandler, 0, "TriggerWatcher Settings");
76+
char sCookieMenuTitle[64];
77+
FormatEx(sCookieMenuTitle, sizeof(sCookieMenuTitle), "%t", "TW_Menu_Cookie");
78+
SetCookieMenuItem(CookieHandler, 0, sCookieMenuTitle);
7779
g_hCookie_DisplayType = new Cookie("TriggerWatcher_display", "TriggerWatcher display method", CookieAccess_Private);
7880

7981
/* HOOKS */
@@ -116,6 +118,7 @@ public void Event_RoundStart(Event hEvent, const char[] sName, bool bDontBroadca
116118
public void OnMapEnd()
117119
{
118120
UnhookEntityOutput("func_button", "OnPressed", ButtonPressed);
121+
UnhookEntityOutput("func_rot_button", "OnPressed", ButtonPressed);
119122
UnhookEntityOutput("trigger_once", "OnTrigger", TriggerTouched);
120123
UnhookEntityOutput("trigger_multiple", "OnStartTouch", TriggerTouched);
121124
UnhookEntityOutput("trigger_teleport", "OnStartTouch", TriggerTouched);
@@ -378,7 +381,7 @@ void NotifyButton(int activator, const char[] userid, const char[] entity, bool
378381
if (!ShouldNotifyClient(i))
379382
continue;
380383

381-
NotifyMode mode = isSpam ? g_ClientState[i].triggersDisplay : g_ClientState[i].buttonsDisplay;
384+
NotifyMode mode = g_ClientState[i].buttonsDisplay;
382385
if (mode == Notify_Console || mode == Notify_Both)
383386
{
384387
if (isSpam)

0 commit comments

Comments
 (0)