Improvements and fixes

This commit is contained in:
TotallyNotElite 2018-07-20 19:28:14 +02:00
parent aba99af9eb
commit dcdfec4609
5 changed files with 33 additions and 60 deletions

View File

@ -82,7 +82,6 @@ Vector VischeckWall(CachedEntity *player, CachedEntity *target, float maxdist,
float vectorMax(Vector i);
Vector vectorAbs(Vector i);
bool canReachVector(Vector loc, Vector dest = {0,0,0});
bool isJumping(Vector vec);
bool LineIntersectsBox(Vector &bmin, Vector &bmax, Vector &lmin, Vector &lmax);

View File

@ -201,7 +201,7 @@ bool BacktrackAimbot()
{
bool good_tick = false;
for (int j = 0; j < 12; ++j)
if (tickcnt == hacks::shared::backtrack::sorted_ticks[j].tick && hacks::shared::backtrack::sorted_ticks[j].tickcount != FLT_MAX)
if (tickcnt == hacks::shared::backtrack::sorted_ticks[j].tick && hacks::shared::backtrack::sorted_ticks[j].tickcount != INT_MAX)
good_tick = true;
tickcnt++;
if (!i.hitboxpos.z)

View File

@ -174,7 +174,7 @@ void Run()
{
bool good_tick = false;
for (int i = 0; i < 12; ++i)
if (t == sorted_ticks[i].tick && sorted_ticks[i].tickcount != FLT_MAX)
if (t == sorted_ticks[i].tick && sorted_ticks[i].tickcount != INT_MAX)
good_tick = true;
if (!good_tick)
continue;

View File

@ -63,9 +63,10 @@ static const int crumb_limit = 64; // limit
// Followed entity, externed for highlight color
int follow_target = 0;
bool inited;
static bool inited;
Timer lastTaunt{}; // time since taunt was last executed, used to avoid kicks
Timer lastJump{};
std::array<Timer, 32> afkTicks; // for how many ms the player hasn't been moving
void checkAFK()
@ -75,7 +76,7 @@ void checkAFK()
auto entity = ENTITY(i);
if (CE_BAD(entity))
continue;
if (!CE_VECTOR(entity, netvar.vVelocity).IsZero(5.0f))
if (!CE_VECTOR(entity, netvar.vVelocity).IsZero(40.0f))
{
afkTicks[i].update();
}
@ -306,12 +307,6 @@ void WorldTick()
}
}
// if(!checkPath()) //wip do not merge if you see this
// {
// follow_target = 0;
// return;
// }
// Update timer on new target
static Timer idle_time{};
if (breadcrumbs.empty())
@ -331,7 +326,7 @@ void WorldTick()
// New crumbs, we add one if its empty so we have something to follow
if ((breadcrumbs.empty() ||
tar_orig.DistTo(breadcrumbs.at(breadcrumbs.size() - 1)) > 40.0F) &&
DistanceToGround(ENTITY(follow_target)) < 30)
DistanceToGround(ENTITY(follow_target)) < 45)
breadcrumbs.push_back(tar_orig);
// Prune old and close crumbs that we wont need anymore, update idle timer
@ -357,14 +352,24 @@ void WorldTick()
if (dist_to_target > (float) follow_distance)
{
// Check for jump
if (autojump && (idle_time.check(2000) || isJumping(breadcrumbs[0])))
if (autojump && lastJump.check(1000) && (idle_time.check(2000) || DistanceToGround(breadcrumbs[0]) > 42))
{
g_pUserCmd->buttons |= IN_JUMP;
// Check for idle
lastJump.update();
}
// Check if still moving. 70 HU = Sniper Zoomed Speed
if (idle_time.check(3000) && CE_VECTOR(g_pLocalPlayer->entity, netvar.vVelocity).IsZero(60.0f))
{
follow_target = 0;
return;
}
// Basic idle check
if (idle_time.test_and_set(5000))
{
follow_target = 0;
return;
}
static float last_slot_check = 0.0f;
if (g_GlobalVars->curtime < last_slot_check)
last_slot_check = 0.0f;

View File

@ -192,16 +192,10 @@ bool canReachVector(Vector loc, Vector dest)
int maxiterations = floor(dest.DistTo(loc)) / 40;
for (int i = 0; i < maxiterations; i++)
{
// math to get the next vector 40.0f in the direction of dest
Vector vec = loc + dist / vectorMax(vectorAbs(dist)) * 40.0f * (i + 1);
trace_t trace;
Ray_t ray;
Vector down = vec;
down.z = down.z - 50;
ray.Init(vec, down);
g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player,
&trace);
if (!(trace.startpos.DistTo(trace.endpos) <= 45))
if (DistanceToGround(vec) >= 45)
return false;
for (int j = 0; j < 4; j++)
@ -223,13 +217,13 @@ bool canReachVector(Vector loc, Vector dest)
directionalLoc.y = directionalLoc.y - 40;
break;
}
trace_t trace2;
Ray_t ray2;
ray2.Init(vec, directionalLoc);
g_ITrace->TraceRay(ray2, 0x4200400B, &trace::filter_no_player,
&trace2);
trace_t trace;
Ray_t ray;
ray.Init(vec, directionalLoc);
g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player,
&trace);
// distance of trace < than 26
if (trace2.startpos.DistTo(trace2.endpos) < 26.0f)
if (trace.startpos.DistTo(trace.endpos) < 26.0f)
return false;
}
}
@ -237,16 +231,11 @@ bool canReachVector(Vector loc, Vector dest)
else
{
// check if the vector is too high above ground
trace_t trace;
Ray_t ray;
Vector down = loc;
down.z = down.z - 50;
ray.Init(loc, down);
g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player, &trace);
// higher to avoid small false positives, player can jump 42 hu according to
// the tf2 wiki
if (!(trace.startpos.DistTo(trace.endpos) <= 45))
if (DistanceToGround(loc) >= 45)
return false;
// check if there is enough space arround the vector for a player to fit
// for loop for all 4 directions
for (int i = 0; i < 4; i++)
@ -268,38 +257,18 @@ bool canReachVector(Vector loc, Vector dest)
directionalLoc.y = directionalLoc.y - 40;
break;
}
trace_t trace2;
Ray_t ray2;
ray2.Init(loc, directionalLoc);
g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player, &trace2);
trace_t trace;
Ray_t ray;
ray.Init(loc, directionalLoc);
g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player, &trace);
// distance of trace < than 26
if (trace2.startpos.DistTo(trace2.endpos) < 26.0f)
if (trace.startpos.DistTo(trace.endpos) < 26.0f)
return false;
}
}
return true;
}
// returns if the player is currently jumping/falling.
bool isJumping(Vector vec)
{
// check if the vector is too high above ground
trace_t trace;
Ray_t ray;
Vector down = vec;
Vector loc = vec;
down.z = down.z - 50;
loc.z = loc.z + 5;
ray.Init(vec, down);
// trace::filter_no_player.SetSelf(RAW_ENT(g_pLocalPlayer->entity));
g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player, &trace);
// lower to avoid small false negatives, player can jump 42 hu according to
// the tf2 wiki, higher because loc.z = loc.z + 5;
if (trace.startpos.DistTo(trace.endpos) > 45)
return true;
return false;
}
std::string GetLevelName()
{