More fixes on followbot & autoheal

This commit is contained in:
BenCat07 2018-07-08 14:41:28 +02:00
parent 1f8c46a9bd
commit 7ede45ef2d
2 changed files with 10 additions and 4 deletions

View File

@ -315,6 +315,12 @@ static CatCommand heal_steamid(
if (args.ArgC() < 2) if (args.ArgC() < 2)
{ {
logging::Info("Invalid call!"); logging::Info("Invalid call!");
force_healing_target = 0;
return;
}
if (strtol(args.Arg(1), nullptr, 10) == 0x0)
{
force_healing_target = 0;
return; return;
} }
for (int i = 1; i <= 32 && i < HIGHEST_ENTITY; i++) for (int i = 1; i <= 32 && i < HIGHEST_ENTITY; i++)

View File

@ -184,7 +184,7 @@ void WorldTick()
if (CE_BAD(entity)) // Exist + dormant if (CE_BAD(entity)) // Exist + dormant
continue; continue;
if (i == follow_target) if (i == follow_target)
break; continue;
if (entity->m_Type() != ENTITY_PLAYER) if (entity->m_Type() != ENTITY_PLAYER)
continue; continue;
if (steamid != entity->player_info.friendsID) // steamid check if (steamid != entity->player_info.friendsID) // steamid check
@ -211,11 +211,11 @@ void WorldTick()
} }
// If we dont have a follow target from that, we look again for someone // If we dont have a follow target from that, we look again for someone
// else who is suitable // else who is suitable
if ((!follow_target || change || ClassPriority(ENTITY(follow_target)) < 6) && roambot) if ((!follow_target || change || (ClassPriority(ENTITY(follow_target)) < 6 && ENTITY(follow_target)->player_info.friendsID != steamid)) && roambot)
{ {
// Try to get a new target // Try to get a new target
auto ent_count = HIGHEST_ENTITY; auto ent_count = followcart ? HIGHEST_ENTITY : g_IEngine->GetMaxClients();
for (int i = 0; i < HIGHEST_ENTITY; i++) for (int i = 0; i < ent_count; i++)
{ {
auto entity = ENTITY(i); auto entity = ENTITY(i);
if (CE_BAD(entity)) // Exist + dormant if (CE_BAD(entity)) // Exist + dormant