diff --git a/src/hacks/FollowBot.cpp b/src/hacks/FollowBot.cpp index 20fe0da6..0f213ea6 100644 --- a/src/hacks/FollowBot.cpp +++ b/src/hacks/FollowBot.cpp @@ -35,8 +35,7 @@ CatCommand follow_steam("fb_steam", "Follow Steam Id", steamid = 0x0; return; } - unsigned tempid = atol(args.Arg(1)); - steamid = *(unsigned int *) &tempid; + steamid = atol(args.Arg(1)); }); static CatVar mimic_slot(CV_SWITCH, "fb_mimic_slot", "0", "Mimic weapon slot", @@ -198,9 +197,6 @@ void WorldTick() if (!entity->m_bAlivePlayer()) // Dont follow dead players continue; - lastent++; - if (lastent > g_IEngine->GetMaxClients()) - lastent = 0; if (corneractivate) { Vector indirectOrigin = @@ -290,13 +286,15 @@ void WorldTick() if (corneractivate) { Vector indirectOrigin = - VischeckCorner(LOCAL_E, entity, 500, + VischeckCorner(LOCAL_E, entity, 250, true); // get the corner location that the // future target is visible from std::pair corners; + corners.first.z = 0; + corners.second.z = 0; if (!indirectOrigin.z && entity->m_IDX == lastent) // if we couldn't find it, run wallcheck instead { - corners = VischeckWall(LOCAL_E, entity, 500, true); + corners = VischeckWall(LOCAL_E, entity, 250, true); if (!corners.first.z || !corners.second.z) continue; addCrumbs(LOCAL_E, corners.first); @@ -318,6 +316,9 @@ void WorldTick() afkTicks[i].update(); // set afk time to 0 } } + lastent++; + if (lastent > g_IEngine->GetMaxClients()) + lastent = 0; // last check for entity before we continue if (!follow_target) return; diff --git a/src/helpers.cpp b/src/helpers.cpp index fd1b718d..79b5feb3 100644 --- a/src/helpers.cpp +++ b/src/helpers.cpp @@ -212,7 +212,7 @@ std::pair VischeckWall(CachedEntity *player, CachedEntity *target // 40 * maxiterations = range in HU for (int j = 0; j < maxiterations; j++) { - Vector virtualOrigin2 = origin; + Vector virtualOrigin2 = target->m_vecOrigin(); // what direction to go in switch (i) { @@ -238,9 +238,9 @@ std::pair VischeckWall(CachedEntity *player, CachedEntity *target if (!checkWalkable) return toret; // check if the location is accessible - if (!canReachVector(origin, virtualOrigin) || !canReachVector(target->m_vecOrigin(), virtualOrigin2)) + if (!canReachVector(origin, virtualOrigin) || !canReachVector(virtualOrigin2, virtualOrigin) || !canReachVector(target->m_vecOrigin(), virtualOrigin2)) continue; - if (canReachVector(virtualOrigin, target->m_vecOrigin())) + if (canReachVector(virtualOrigin2, target->m_vecOrigin())) return toret; } }