From 9ca4d7dfc8b05dd68f7474851770755194d401fb Mon Sep 17 00:00:00 2001 From: Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> Date: Sat, 8 Apr 2023 20:14:00 +0100 Subject: Fix stringcmd limits causing unnecessary disconnects (#447) revert some changes made by #411 --- NorthstarDLL/shared/exploit_fixes/ns_limits.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'NorthstarDLL/shared') diff --git a/NorthstarDLL/shared/exploit_fixes/ns_limits.cpp b/NorthstarDLL/shared/exploit_fixes/ns_limits.cpp index b01a9b98..35756044 100644 --- a/NorthstarDLL/shared/exploit_fixes/ns_limits.cpp +++ b/NorthstarDLL/shared/exploit_fixes/ns_limits.cpp @@ -56,10 +56,10 @@ bool ServerLimitsManager::CheckStringCommandLimits(R2::CBaseClient* player) if (CVar_sv_quota_stringcmdspersecond->GetInt() != -1) { // note: this isn't super perfect, legit clients can trigger it in lobby if they try, mostly good enough tho imo - if (R2::g_pGlobals->m_flCurTime - m_PlayerLimitData[player].lastClientCommandQuotaStart >= 1.0) + if (Tier0::Plat_FloatTime() - m_PlayerLimitData[player].lastClientCommandQuotaStart >= 1.0) { // reset quota - m_PlayerLimitData[player].lastClientCommandQuotaStart = R2::g_pGlobals->m_flCurTime; + m_PlayerLimitData[player].lastClientCommandQuotaStart = Tier0::Plat_FloatTime(); m_PlayerLimitData[player].numClientCommandsInQuota = 0; } @@ -76,9 +76,9 @@ bool ServerLimitsManager::CheckStringCommandLimits(R2::CBaseClient* player) bool ServerLimitsManager::CheckChatLimits(R2::CBaseClient* player) { - if (R2::g_pGlobals->m_flCurTime - m_PlayerLimitData[player].lastSayTextLimitStart >= 1.0) + if (Tier0::Plat_FloatTime() - m_PlayerLimitData[player].lastSayTextLimitStart >= 1.0) { - m_PlayerLimitData[player].lastSayTextLimitStart = R2::g_pGlobals->m_flCurTime; + m_PlayerLimitData[player].lastSayTextLimitStart = Tier0::Plat_FloatTime(); m_PlayerLimitData[player].sayTextLimitCount = 0; } @@ -100,7 +100,7 @@ char, __fastcall, (void* self, void* buf)) NETCHANLIMIT_KICK }; - double startTime = R2::g_pGlobals->m_flCurTime; + double startTime = Tier0::Plat_FloatTime(); char ret = CNetChan__ProcessMessages(self, buf); // check processing limits, unless we're in a level transition @@ -121,7 +121,7 @@ char, __fastcall, (void* self, void* buf)) g_pServerLimits->m_PlayerLimitData[sender].lastNetChanProcessingLimitStart = startTime; g_pServerLimits->m_PlayerLimitData[sender].netChanProcessingLimitTime = 0.0; } - g_pServerLimits->m_PlayerLimitData[sender].netChanProcessingLimitTime += (R2::g_pGlobals->m_flCurTime * 1000) - (startTime * 1000); + g_pServerLimits->m_PlayerLimitData[sender].netChanProcessingLimitTime += (Tier0::Plat_FloatTime() * 1000) - (startTime * 1000); if (g_pServerLimits->m_PlayerLimitData[sender].netChanProcessingLimitTime >= g_pServerLimits->Cvar_net_chan_limit_msec_per_sec->GetInt()) @@ -172,12 +172,12 @@ bool, , (void* a1, R2::netpacket_t* packet)) memcpy(sendData->ip, packet->adr.ip, 16); } - if (R2::g_pGlobals->m_flCurTime < sendData->timeoutEnd) + if (Tier0::Plat_FloatTime() < sendData->timeoutEnd) return false; - if (R2::g_pGlobals->m_flCurTime - sendData->lastQuotaStart >= 1.0) + if (Tier0::Plat_FloatTime() - sendData->lastQuotaStart >= 1.0) { - sendData->lastQuotaStart = R2::g_pGlobals->m_flCurTime; + sendData->lastQuotaStart = Tier0::Plat_FloatTime(); sendData->packetCount = 0; } @@ -191,7 +191,7 @@ bool, , (void* a1, R2::netpacket_t* packet)) packet->data[4]); // timeout for a minute - sendData->timeoutEnd = R2::g_pGlobals->m_flCurTime + 60.0; + sendData->timeoutEnd = Tier0::Plat_FloatTime() + 60.0; return false; } } -- cgit v1.2.3