Fix autobackstab searching for targets even after a valid one was found

This commit is contained in:
BenCat07 2021-05-13 11:33:18 +02:00 committed by LightCat
parent a794b49c64
commit 8aebd9d073

View File

@ -355,6 +355,9 @@ static bool doBacktrackStab(bool legit = false)
// Get the Best tick // Get the Best tick
for (int i = 1; i <= g_IEngine->GetMaxClients(); i++) for (int i = 1; i <= g_IEngine->GetMaxClients(); i++)
{ {
// Found a target, break out
if (stab_ent)
break;
CachedEntity *ent = ENTITY(i); CachedEntity *ent = ENTITY(i);
// Targeting checks // Targeting checks
if (CE_BAD(ent) || !ent->m_bAlivePlayer() || !ent->m_bEnemy() || !player_tools::shouldTarget(ent) || IsPlayerInvulnerable(ent)) if (CE_BAD(ent) || !ent->m_bAlivePlayer() || !ent->m_bEnemy() || !player_tools::shouldTarget(ent) || IsPlayerInvulnerable(ent))