Cleanly remove player after triggering rapidfire anticheat

Previously, the socket was killed but the player was still technically present.
This commit is contained in:
CakeLancelot 2021-05-26 23:23:05 -05:00
parent 8326ea6e26
commit bb12a60e04
1 changed files with 9 additions and 2 deletions

View File

@ -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