Aimbot fix

CAT: 50 / 51 (98%) -> 98% of all shots were hits
CAT: 50 / 50 (100%)  -> 100% of hits were headshots
this is on a server with 120 ping
This commit is contained in:
TotallyNotElite 2018-12-28 15:25:17 +01:00
parent c9f23a80e5
commit 88b0f7c849
3 changed files with 18 additions and 13 deletions

View File

@ -88,7 +88,7 @@ void VectorAngles(Vector &forward, Vector &angles);
void AngleVectors2(const QAngle &angles, Vector *forward);
extern std::mutex trace_lock;
bool IsEntityVisible(CachedEntity *entity, int hb);
bool IsEntityVectorVisible(CachedEntity *entity, Vector endpos, trace_t *trace = nullptr);
bool IsEntityVectorVisible(CachedEntity *entity, Vector endpos, unsigned int mask = MASK_SHOT_HULL, trace_t *trace = nullptr);
bool VisCheckEntFromEnt(CachedEntity *startEnt, CachedEntity *endEnt);
bool VisCheckEntFromEntVector(Vector startVector, CachedEntity *startEnt, CachedEntity *endEnt);
Vector VischeckCorner(CachedEntity *player, CachedEntity *target, float maxdist, bool checkWalkable);

View File

@ -1026,20 +1026,20 @@ int BestHitbox(CachedEntity *target)
if (*backtrackVischeckAll)
for (int j = 0; j < 18; j++)
{
if (IsVectorVisible(g_pLocalPlayer->v_Eye, ticks->hitboxes.at(j).center))
if (IsEntityVectorVisible(target, ticks->hitboxes.at(j).center))
{
good_tick = { i, target->m_IDX };
break;
}
}
else if (IsVectorVisible(g_pLocalPlayer->v_Eye, ticks->hitboxes.at(0).center))
else if (IsEntityVectorVisible(target, ticks->hitboxes.at(0).center))
{
good_tick = { i, target->m_IDX };
break;
}
}
if (good_tick.first != -1)
if (IsVectorVisible(g_pLocalPlayer->v_Eye, bt::headPositions[target->m_IDX][good_tick.first].hitboxes.at(preferred).center))
if (IsEntityVectorVisible(target, bt::headPositions[target->m_IDX][good_tick.first].hitboxes.at(preferred).center))
return preferred;
}
else if (target->hitboxes.VisibilityCheck(preferred))
@ -1048,7 +1048,7 @@ int BestHitbox(CachedEntity *target)
if (IsBacktracking() && !projectile_mode && good_tick.first != -1)
{
for (int i = 0; i < 18; i++)
if (IsVectorVisible(g_pLocalPlayer->v_Eye, bt::headPositions[target->m_IDX][good_tick.first].hitboxes.at(i).center))
if (IsEntityVectorVisible(target, bt::headPositions[target->m_IDX][good_tick.first].hitboxes.at(i).center))
return i;
}
else
@ -1109,18 +1109,23 @@ bool VischeckPredictedEntity(CachedEntity *entity, bool Backtracking)
{
// Update info
cd.vcheck_tick = tickcount;
trace_t trace;
cd.visible = IsEntityVectorVisible(entity, PredictEntity(entity), &trace);
if (cd.visible && cd.hitbox == head && trace.hitbox != head)
cd.visible = false;
if (extrapolate || projectileAimbotRequired || entity->m_Type() != ENTITY_PLAYER)
cd.visible = IsEntityVectorVisible(entity, PredictEntity(entity));
else
{
trace_t trace;
cd.visible = IsEntityVectorVisible(entity, PredictEntity(entity), MASK_SHOT, &trace);
if (cd.visible && cd.hitbox == head && trace.hitbox != head)
cd.visible = false;
}
}
else
{
namespace bt = hacks::shared::backtrack;
auto ticks = bt::headPositions[entity->m_IDX];
if (good_tick.first != -1 && good_tick.second == entity->m_IDX && IsVectorVisible(g_pLocalPlayer->v_Eye, PredictEntity(entity)))
if (good_tick.first != -1 && good_tick.second == entity->m_IDX && IsEntityVectorVisible(entity, PredictEntity(entity)))
{
cd.vcheck_tick = tickcount;
cd.vcheck_tick = tickcount;
cd.visible = true;
current_user_cmd->tick_count = ticks[good_tick.first].tickcount;
Vector &angles = CE_VECTOR(entity, netvar.m_angEyeAngles);

View File

@ -729,7 +729,7 @@ bool IsEntityVisible(CachedEntity *entity, int hb)
}
std::mutex trace_lock;
bool IsEntityVectorVisible(CachedEntity *entity, Vector endpos, trace_t *trace)
bool IsEntityVectorVisible(CachedEntity *entity, Vector endpos, unsigned int mask, trace_t *trace)
{
trace_t trace_object;
if (!trace)
@ -750,7 +750,7 @@ bool IsEntityVectorVisible(CachedEntity *entity, Vector endpos, trace_t *trace)
PROF_SECTION(IEVV_TraceRay);
std::lock_guard<std::mutex> lock(trace_lock);
if (!tcm || g_Settings.is_create_move)
g_ITrace->TraceRay(ray, MASK_SHOT_HULL, &trace::filter_default, trace);
g_ITrace->TraceRay(ray, mask, &trace::filter_default, trace);
}
return (((IClientEntity *) trace->m_pEnt) == RAW_ENT(entity) || trace->fraction >= 0.99f);
}