From 72aeb9578fd525abc69adfdd1589015934f47973 Mon Sep 17 00:00:00 2001 From: Lpsd <40902730+Lpsd@users.noreply.github.com> Date: Mon, 27 Nov 2023 17:17:15 +0000 Subject: [PATCH] Update CGame.cpp --- Server/mods/deathmatch/logic/CGame.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Server/mods/deathmatch/logic/CGame.cpp b/Server/mods/deathmatch/logic/CGame.cpp index 5ac9798318..3f3714222b 100644 --- a/Server/mods/deathmatch/logic/CGame.cpp +++ b/Server/mods/deathmatch/logic/CGame.cpp @@ -4711,11 +4711,15 @@ void CGame::RegisterClientTriggeredEventUsage(CPlayer* pPlayer) if (!pPlayer || !pPlayer->IsPlayer() || pPlayer->IsBeingDeleted()) return; + int now = GetTickCount64_(); + // If key/player doesn't exist in map, store time of entry if (m_mapClientTriggeredEvents.find(pPlayer) == m_mapClientTriggeredEvents.end()) - m_mapClientTriggeredEvents[pPlayer].second = GetTickCount64_(); + m_mapClientTriggeredEvents[pPlayer].second = now; - m_mapClientTriggeredEvents[pPlayer].first++; + // Only increment if we haven't reached the interval time already + if (now - m_mapClientTriggeredEvents[pPlayer].second < m_iClientTriggeredEventsIntervalMs) + m_mapClientTriggeredEvents[pPlayer].first++; } void CGame::ProcessClientTriggeredEventSpam()