parent
2ff71cfca5
commit
0445e05168
@ -28,8 +28,6 @@ struct crithack_saved_state
|
||||
namespace criticals
|
||||
{
|
||||
|
||||
void create_move();
|
||||
void draw();
|
||||
bool random_crits_enabled();
|
||||
} // namespace criticals
|
||||
|
||||
|
@ -15,7 +15,7 @@ namespace hacks::shared::triggerbot
|
||||
void CreateMove();
|
||||
CachedEntity *FindEntInSight(float range);
|
||||
bool ShouldShoot();
|
||||
bool IsTargetStateGood(CachedEntity *entity);
|
||||
bool IsTargetStateGood(CachedEntity *entity, bool backtrack = false);
|
||||
CachedEntity *FindEntInSight(float range);
|
||||
bool HeadPreferable(CachedEntity *target);
|
||||
bool UpdateAimkey();
|
||||
|
@ -255,4 +255,11 @@ void crithack_saved_state::Save(IClientEntity *entity)
|
||||
unknown2620 = *(int *) (uintptr_t(entity) + 2620);
|
||||
seed2876 = *(int *) (uintptr_t(entity) + 2876);
|
||||
unknown2839 = *(char *) (uintptr_t(entity) + 2839);
|
||||
}
|
||||
}
|
||||
|
||||
static InitRoutine init([](){
|
||||
EC::Register(EC::CreateMove, criticals::create_move, "cm_crits", EC::very_late);
|
||||
#if ENABLE_VISUALS
|
||||
EC::Register(EC::Draw, criticals::draw, "draw_crits");
|
||||
#endif
|
||||
});
|
||||
|
@ -78,7 +78,7 @@ void Init()
|
||||
EmptyBacktrackData(headPositions[i][j]);
|
||||
}
|
||||
|
||||
int BestTick = 0;
|
||||
int BestTick = -1;
|
||||
int iBestTarget = -1;
|
||||
bool istickvalid[32][66]{};
|
||||
bool istickinvalid[32][66]{};
|
||||
|
@ -39,52 +39,54 @@ float target_time = 0.0f;
|
||||
|
||||
int last_hb_traced = 0;
|
||||
Vector forward;
|
||||
bool CanBacktrack()
|
||||
void DoBacktrack()
|
||||
{
|
||||
CachedEntity *tar = (hacks::shared::backtrack::iBestTarget != -1) ? ENTITY(hacks::shared::backtrack::iBestTarget) : nullptr;
|
||||
namespace bt = hacks::shared::backtrack;
|
||||
|
||||
CachedEntity *tar = (bt::iBestTarget != -1) ? ENTITY(bt::iBestTarget) : nullptr;
|
||||
if (CE_BAD(tar))
|
||||
return true;
|
||||
for (auto i : hacks::shared::backtrack::headPositions[tar->m_IDX])
|
||||
return;
|
||||
if (bt::BestTick == -1)
|
||||
return;
|
||||
if (!IsTargetStateGood(tar, true))
|
||||
return;
|
||||
auto &tick = bt::headPositions[bt::iBestTarget][bt::BestTick];
|
||||
|
||||
if (!ValidTick(tick, tar))
|
||||
return;
|
||||
auto min = tick.hitboxes.at(head).min;
|
||||
auto max = tick.hitboxes.at(head).max;
|
||||
if (!min.x && !max.x)
|
||||
return;
|
||||
|
||||
// Get the min and max for the hitbox
|
||||
Vector minz(fminf(min.x, max.x), fminf(min.y, max.y), fminf(min.z, max.z));
|
||||
Vector maxz(fmaxf(min.x, max.x), fmaxf(min.y, max.y), fmaxf(min.z, max.z));
|
||||
|
||||
// Shrink the hitbox here
|
||||
Vector size = maxz - minz;
|
||||
Vector smod = size * 0.05f * (int) accuracy;
|
||||
|
||||
// Save the changes to the vectors
|
||||
minz += smod;
|
||||
maxz -= smod;
|
||||
|
||||
// Trace and test if it hits the smaller hitbox, if it fails
|
||||
// we
|
||||
// return false
|
||||
Vector hit;
|
||||
|
||||
if (!IsVectorVisible(g_pLocalPlayer->v_Eye, minz) && !IsVectorVisible(g_pLocalPlayer->v_Eye, maxz))
|
||||
return;
|
||||
if (CheckLineBox(minz, maxz, g_pLocalPlayer->v_Eye, forward, hit))
|
||||
{
|
||||
if (!hacks::shared::backtrack::ValidTick(i, tar))
|
||||
continue;
|
||||
auto min = i.hitboxes.at(head).min;
|
||||
auto max = i.hitboxes.at(head).max;
|
||||
if (!min.x && !max.x)
|
||||
continue;
|
||||
|
||||
// Get the min and max for the hitbox
|
||||
Vector minz(fminf(min.x, max.x), fminf(min.y, max.y), fminf(min.z, max.z));
|
||||
Vector maxz(fmaxf(min.x, max.x), fmaxf(min.y, max.y), fmaxf(min.z, max.z));
|
||||
|
||||
// Shrink the hitbox here
|
||||
Vector size = maxz - minz;
|
||||
Vector smod = size * 0.05f * (int) accuracy;
|
||||
|
||||
// Save the changes to the vectors
|
||||
minz += smod;
|
||||
maxz -= smod;
|
||||
|
||||
// Trace and test if it hits the smaller hitbox, if it fails
|
||||
// we
|
||||
// return false
|
||||
Vector hit;
|
||||
|
||||
if (!IsVectorVisible(g_pLocalPlayer->v_Eye, minz) && !IsVectorVisible(g_pLocalPlayer->v_Eye, maxz))
|
||||
continue;
|
||||
if (CheckLineBox(minz, maxz, g_pLocalPlayer->v_Eye, forward, hit))
|
||||
{
|
||||
Vector &angles = NET_VECTOR(RAW_ENT(tar), netvar.m_angEyeAngles);
|
||||
float &simtime = NET_FLOAT(RAW_ENT(tar), netvar.m_flSimulationTime);
|
||||
angles.y = i.viewangles;
|
||||
current_user_cmd->tick_count = i.tickcount;
|
||||
current_user_cmd->buttons |= IN_ATTACK;
|
||||
return true;
|
||||
}
|
||||
current_user_cmd->tick_count = tick.tickcount;
|
||||
current_user_cmd->buttons |= IN_ATTACK;
|
||||
return;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// The main "loop" of the triggerbot
|
||||
|
||||
// The main function of the triggerbot
|
||||
void CreateMove()
|
||||
{
|
||||
|
||||
@ -106,7 +108,7 @@ void CreateMove()
|
||||
{
|
||||
// We need to return because we can't hit non backtrackable ticks if we
|
||||
// have backtrack latency.
|
||||
CanBacktrack();
|
||||
DoBacktrack();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -223,7 +225,7 @@ bool ShouldShoot()
|
||||
}
|
||||
|
||||
// A second check to determine whether a target is good enough to be aimed at
|
||||
bool IsTargetStateGood(CachedEntity *entity)
|
||||
bool IsTargetStateGood(CachedEntity *entity, bool backtrack)
|
||||
{
|
||||
|
||||
// Check for Players
|
||||
@ -274,7 +276,7 @@ bool IsTargetStateGood(CachedEntity *entity)
|
||||
}
|
||||
|
||||
// Head hitbox detection
|
||||
if (HeadPreferable(entity))
|
||||
if (HeadPreferable(entity) && !backtrack)
|
||||
{
|
||||
if (last_hb_traced != hitbox_t::head)
|
||||
return false;
|
||||
@ -282,7 +284,7 @@ bool IsTargetStateGood(CachedEntity *entity)
|
||||
|
||||
// If usersettings tell us to use accuracy improvements and the cached
|
||||
// hitbox isnt null, then we check if it hits here
|
||||
if (*accuracy)
|
||||
if (*accuracy && !backtrack)
|
||||
{
|
||||
|
||||
// Get a cached hitbox for the one traced
|
||||
@ -623,7 +625,5 @@ void Draw()
|
||||
{
|
||||
}
|
||||
|
||||
static InitRoutine EC([]() {
|
||||
EC::Register(EC::CreateMove, CreateMove, "triggerbot", EC::average);
|
||||
});
|
||||
static InitRoutine EC([]() { EC::Register(EC::CreateMove, CreateMove, "triggerbot", EC::average); });
|
||||
} // namespace hacks::shared::triggerbot
|
||||
|
Reference in New Issue
Block a user