From bb12a60e042f87c3ba82c12d91f68a4388099858 Mon Sep 17 00:00:00 2001 From: CakeLancelot Date: Wed, 26 May 2021 23:23:05 -0500 Subject: [PATCH] Cleanly remove player after triggering rapidfire anticheat Previously, the socket was killed but the player was still technically present. --- src/Combat.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Combat.cpp b/src/Combat.cpp index 186aea8..ea79f0a 100644 --- a/src/Combat.cpp +++ b/src/Combat.cpp @@ -74,8 +74,12 @@ static void pcAttackNpcs(CNSocket *sock, CNPacketData *data) { if (pkt->iNPCCnt > 3) // 3+ targets should never be possible plr->suspicionRating += 10000; - if (plr->suspicionRating > 10000) // kill the socket when the player is too suspicious + if (plr->suspicionRating > 10000) { // kill the socket when the player is too suspicious sock->kill(); + CNShardServer::_killConnection(sock); + return; + } + /* * IMPORTANT: This validates memory safety in addition to preventing @@ -625,8 +629,11 @@ static void projectileHit(CNSocket* sock, CNPacketData* data) { plr->lastShot = currTime; - if (plr->suspicionRating > 10000) // kill the socket when the player is too suspicious + if (plr->suspicionRating > 10000) { // kill the socket when the player is too suspicious sock->kill(); + CNShardServer::_killConnection(sock); + return; + } /* * initialize response struct