diff options
author | Jack <66967891+ASpoonPlaysGames@users.noreply.github.com> | 2023-04-08 20:14:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-08 21:14:00 +0200 |
commit | 72da1da5b4c04ccc1154853a308cab6459c60b79 (patch) | |
tree | 41b7e4e172d3c7d8c2cc37611a4764d8fe352897 /NorthstarDLL/shared/exploit_fixes/ns_limits.cpp | |
parent | d7637c7ab58623023e2ba023416919f7107af371 (diff) | |
download | NorthstarLauncher-72da1da5b4c04ccc1154853a308cab6459c60b79.tar.gz NorthstarLauncher-72da1da5b4c04ccc1154853a308cab6459c60b79.zip |
Fix stringcmd limits causing unnecessary disconnects (#447)
revert some changes made by #411
Diffstat (limited to 'NorthstarDLL/shared/exploit_fixes/ns_limits.cpp')
-rw-r--r-- | NorthstarDLL/shared/exploit_fixes/ns_limits.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
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; } } |