Improvements and fixes
This commit is contained in:
parent
aba99af9eb
commit
dcdfec4609
@ -82,7 +82,6 @@ Vector VischeckWall(CachedEntity *player, CachedEntity *target, float maxdist,
|
|||||||
float vectorMax(Vector i);
|
float vectorMax(Vector i);
|
||||||
Vector vectorAbs(Vector i);
|
Vector vectorAbs(Vector i);
|
||||||
bool canReachVector(Vector loc, Vector dest = {0,0,0});
|
bool canReachVector(Vector loc, Vector dest = {0,0,0});
|
||||||
bool isJumping(Vector vec);
|
|
||||||
|
|
||||||
bool LineIntersectsBox(Vector &bmin, Vector &bmax, Vector &lmin, Vector &lmax);
|
bool LineIntersectsBox(Vector &bmin, Vector &bmax, Vector &lmin, Vector &lmax);
|
||||||
|
|
||||||
|
@ -201,7 +201,7 @@ bool BacktrackAimbot()
|
|||||||
{
|
{
|
||||||
bool good_tick = false;
|
bool good_tick = false;
|
||||||
for (int j = 0; j < 12; ++j)
|
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;
|
good_tick = true;
|
||||||
tickcnt++;
|
tickcnt++;
|
||||||
if (!i.hitboxpos.z)
|
if (!i.hitboxpos.z)
|
||||||
|
@ -174,7 +174,7 @@ void Run()
|
|||||||
{
|
{
|
||||||
bool good_tick = false;
|
bool good_tick = false;
|
||||||
for (int i = 0; i < 12; ++i)
|
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;
|
good_tick = true;
|
||||||
if (!good_tick)
|
if (!good_tick)
|
||||||
continue;
|
continue;
|
||||||
|
@ -63,9 +63,10 @@ static const int crumb_limit = 64; // limit
|
|||||||
|
|
||||||
// Followed entity, externed for highlight color
|
// Followed entity, externed for highlight color
|
||||||
int follow_target = 0;
|
int follow_target = 0;
|
||||||
bool inited;
|
static bool inited;
|
||||||
|
|
||||||
Timer lastTaunt{}; // time since taunt was last executed, used to avoid kicks
|
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
|
std::array<Timer, 32> afkTicks; // for how many ms the player hasn't been moving
|
||||||
|
|
||||||
void checkAFK()
|
void checkAFK()
|
||||||
@ -75,7 +76,7 @@ void checkAFK()
|
|||||||
auto entity = ENTITY(i);
|
auto entity = ENTITY(i);
|
||||||
if (CE_BAD(entity))
|
if (CE_BAD(entity))
|
||||||
continue;
|
continue;
|
||||||
if (!CE_VECTOR(entity, netvar.vVelocity).IsZero(5.0f))
|
if (!CE_VECTOR(entity, netvar.vVelocity).IsZero(40.0f))
|
||||||
{
|
{
|
||||||
afkTicks[i].update();
|
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
|
// Update timer on new target
|
||||||
static Timer idle_time{};
|
static Timer idle_time{};
|
||||||
if (breadcrumbs.empty())
|
if (breadcrumbs.empty())
|
||||||
@ -331,7 +326,7 @@ void WorldTick()
|
|||||||
// New crumbs, we add one if its empty so we have something to follow
|
// New crumbs, we add one if its empty so we have something to follow
|
||||||
if ((breadcrumbs.empty() ||
|
if ((breadcrumbs.empty() ||
|
||||||
tar_orig.DistTo(breadcrumbs.at(breadcrumbs.size() - 1)) > 40.0F) &&
|
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);
|
breadcrumbs.push_back(tar_orig);
|
||||||
|
|
||||||
// Prune old and close crumbs that we wont need anymore, update idle timer
|
// 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)
|
if (dist_to_target > (float) follow_distance)
|
||||||
{
|
{
|
||||||
// Check for jump
|
// 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;
|
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))
|
if (idle_time.test_and_set(5000))
|
||||||
{
|
{
|
||||||
follow_target = 0;
|
follow_target = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static float last_slot_check = 0.0f;
|
static float last_slot_check = 0.0f;
|
||||||
if (g_GlobalVars->curtime < last_slot_check)
|
if (g_GlobalVars->curtime < last_slot_check)
|
||||||
last_slot_check = 0.0f;
|
last_slot_check = 0.0f;
|
||||||
|
@ -192,16 +192,10 @@ bool canReachVector(Vector loc, Vector dest)
|
|||||||
int maxiterations = floor(dest.DistTo(loc)) / 40;
|
int maxiterations = floor(dest.DistTo(loc)) / 40;
|
||||||
for (int i = 0; i < maxiterations; i++)
|
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);
|
Vector vec = loc + dist / vectorMax(vectorAbs(dist)) * 40.0f * (i + 1);
|
||||||
|
|
||||||
trace_t trace;
|
if (DistanceToGround(vec) >= 45)
|
||||||
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))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (int j = 0; j < 4; j++)
|
for (int j = 0; j < 4; j++)
|
||||||
@ -223,13 +217,13 @@ bool canReachVector(Vector loc, Vector dest)
|
|||||||
directionalLoc.y = directionalLoc.y - 40;
|
directionalLoc.y = directionalLoc.y - 40;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
trace_t trace2;
|
trace_t trace;
|
||||||
Ray_t ray2;
|
Ray_t ray;
|
||||||
ray2.Init(vec, directionalLoc);
|
ray.Init(vec, directionalLoc);
|
||||||
g_ITrace->TraceRay(ray2, 0x4200400B, &trace::filter_no_player,
|
g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player,
|
||||||
&trace2);
|
&trace);
|
||||||
// distance of trace < than 26
|
// distance of trace < than 26
|
||||||
if (trace2.startpos.DistTo(trace2.endpos) < 26.0f)
|
if (trace.startpos.DistTo(trace.endpos) < 26.0f)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -237,16 +231,11 @@ bool canReachVector(Vector loc, Vector dest)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// check if the vector is too high above ground
|
// 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
|
// higher to avoid small false positives, player can jump 42 hu according to
|
||||||
// the tf2 wiki
|
// the tf2 wiki
|
||||||
if (!(trace.startpos.DistTo(trace.endpos) <= 45))
|
if (DistanceToGround(loc) >= 45)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// check if there is enough space arround the vector for a player to fit
|
// check if there is enough space arround the vector for a player to fit
|
||||||
// for loop for all 4 directions
|
// for loop for all 4 directions
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
@ -268,38 +257,18 @@ bool canReachVector(Vector loc, Vector dest)
|
|||||||
directionalLoc.y = directionalLoc.y - 40;
|
directionalLoc.y = directionalLoc.y - 40;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
trace_t trace2;
|
trace_t trace;
|
||||||
Ray_t ray2;
|
Ray_t ray;
|
||||||
ray2.Init(loc, directionalLoc);
|
ray.Init(loc, directionalLoc);
|
||||||
g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player, &trace2);
|
g_ITrace->TraceRay(ray, 0x4200400B, &trace::filter_no_player, &trace);
|
||||||
// distance of trace < than 26
|
// distance of trace < than 26
|
||||||
if (trace2.startpos.DistTo(trace2.endpos) < 26.0f)
|
if (trace.startpos.DistTo(trace.endpos) < 26.0f)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
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()
|
std::string GetLevelName()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user