Add anti-backburner and fix pyro range

This commit is contained in:
LightCat 2018-11-10 18:21:30 +01:00
parent 5f281011cb
commit b012a07401
6 changed files with 64 additions and 42 deletions

View File

@ -118,7 +118,9 @@ void CreateMove()
current_user_cmd->buttons |= IN_ATTACK2;
if (g_pLocalPlayer->weapon()->m_iClassID() == CL_CLASS(CTFMinigun))
if (auto_spin_up && CE_INT(g_pLocalPlayer->weapon(), netvar.m_iAmmo + 4) != 0 && !zoomTime.check(1000))
if (auto_spin_up &&
CE_INT(g_pLocalPlayer->weapon(), netvar.m_iAmmo + 4) != 0 &&
!zoomTime.check(1000))
current_user_cmd->buttons |= IN_ATTACK2;
// We do this as we need to pass whether the aimkey allows aiming to both
@ -406,7 +408,7 @@ CachedEntity *RetrieveBestTarget(bool aimkey_state)
break;
case 4: // Distance Priority (Furthest Away)
scr = calculated_data_array[i].aim_position.DistTo(
g_pLocalPlayer->v_Eye);
g_pLocalPlayer->v_Eye);
break;
case 6: // Health Priority (Highest)
scr = ent->m_iHealth() * 4;
@ -430,7 +432,7 @@ CachedEntity *RetrieveBestTarget(bool aimkey_state)
target_highest_ent = ENTITY(hacks::shared::backtrack::iBestTarget);
if (!IsTargetStateGood(target_highest_ent))
target_highest_ent = nullptr;
foundTarget = true;
foundTarget = true;
}
// Save the ent for future use with target lock
@ -1276,7 +1278,7 @@ float EffectiveTargetingRange()
if (GetWeaponMode() == weapon_melee)
return (float) re::C_TFWeaponBaseMelee::GetSwingRange(RAW_ENT(LOCAL_W));
if (g_pLocalPlayer->weapon()->m_iClassID() == CL_CLASS(CTFFlameThrower))
return 185.0f; // Pyros only have so much until their flames hit
return 310.0f; // Pyros only have so much until their flames hit
return (float) max_range;
}

View File

@ -66,8 +66,20 @@ CachedEntity *ClosestSpy()
continue;
if (CE_BYTE(ent, netvar.iLifeState))
continue;
bool ispyro = false;
if (CE_INT(ent, netvar.iClass) != tf_class::tf_spy)
continue;
{
if (CE_INT(ent, netvar.iClass) != tf_class::tf_pyro)
continue;
int idx = CE_INT(ent, netvar.hActiveWeapon) & 0xFFF;
if (IDX_BAD(idx))
continue;
CachedEntity *pyro_weapon = ENTITY(idx);
int widx = CE_INT(pyro_weapon, netvar.iItemDefinitionIndex);
if (widx != 40 && widx != 1146)
continue;
ispyro = true;
}
if (CE_INT(ent, netvar.iTeamNum) == g_pLocalPlayer->team)
continue;
if (IsPlayerInvisible(ent))
@ -78,7 +90,9 @@ CachedEntity *ClosestSpy()
break;
// logging::Info("Backstab???");
}
if (dist < (float) distance && (dist < closest_dist || !closest_dist))
if ((((!ispyro && dist < (float) distance)) ||
(ispyro && dist < 314.0f)) &&
(dist < closest_dist || !closest_dist))
{
closest_dist = dist;
closest = ent;
@ -97,7 +111,7 @@ void CreateMove()
spy = ClosestSpy();
if (spy)
{
noaa = true;
noaa = true;
if (current_user_cmd->buttons & IN_ATTACK)
return;
const Vector &A = LOCAL_E->m_vecOrigin();

View File

@ -308,10 +308,10 @@ void EmptyBacktrackData(BacktrackData &i)
// This func is internal only
std::pair<int, int> getBestEntBestTick()
{
int bestEnt = -1;
int bestTick = -1;
int bestEnt = -1;
int bestTick = -1;
bool vischeck_priority = false;
Vischeck_Success = false;
Vischeck_Success = false;
if (GetWeaponMode() == weapon_melee)
{
float bestDist = 9999.0f;
@ -331,18 +331,23 @@ std::pair<int, int> getBestEntBestTick()
headPositions[i][j]
.hitboxes.at(spine_3)
.center.DistTo(g_pLocalPlayer->v_Eye);
if (dist > bestDist && vischeck_priority)
continue;
bool Vischeck_suceeded = IsVectorVisible(g_pLocalPlayer->v_Eye, headPositions[i][j]
.hitboxes.at(0).center, true);
if (((dist < bestDist) || (Vischeck_suceeded && !vischeck_priority)) && dist > *mindistance && (vischeck_priority ? Vischeck_suceeded : true))
if (dist > bestDist && vischeck_priority)
continue;
bool Vischeck_suceeded = IsVectorVisible(
g_pLocalPlayer->v_Eye,
headPositions[i][j].hitboxes.at(0).center,
true);
if (((dist < bestDist) ||
(Vischeck_suceeded && !vischeck_priority)) &&
dist > *mindistance &&
(vischeck_priority ? Vischeck_suceeded : true))
{
bestEnt = i;
bestTick = j;
bestDist = dist;
if (Vischeck_suceeded)
{
Vischeck_Success = true;
Vischeck_Success = true;
vischeck_priority = true;
}
}

View File

@ -157,7 +157,7 @@ void DoSlowAim(Vector &input_angle)
}
static HookedFunction
SandwichAim(HookedFunctions_types::HF_CreateMove, "SandwichAim", 1, []() {
SandwichAim(HookedFunctions_types::HF_CreateMove, "SandwichAim", 5, []() {
if (!*sandwichaim_enabled)
return;
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || CE_BAD(LOCAL_W))
@ -230,34 +230,33 @@ static HookedFunction
static settings::Bool charge_control{ "chargecontrol.enable", "false" };
static settings::Float charge_float{ "chargecontrol.strength", "3.0f" };
static HookedFunction
ChargeControl(HookedFunctions_types::HF_CreateMove, "chargecontrol", 1,
[]() {
if (!*charge_control || charge_aimbotted)
return;
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || CE_BAD(LOCAL_W))
return;
if (!HasCondition<TFCond_Charging>(LOCAL_E))
return;
float offset = 0.0f;
if (current_user_cmd->buttons & IN_MOVELEFT)
offset = *charge_float;
if (current_user_cmd->buttons & IN_MOVERIGHT)
offset = -*charge_float;
current_user_cmd->viewangles.y += offset;
});
static HookedFunction ChargeControl(
HookedFunctions_types::HF_CreateMove, "chargecontrol", 5, []() {
if (!*charge_control || charge_aimbotted)
return;
if (CE_BAD(LOCAL_E) || !LOCAL_E->m_bAlivePlayer() || CE_BAD(LOCAL_W))
return;
if (!HasCondition<TFCond_Charging>(LOCAL_E))
return;
float offset = 0.0f;
if (current_user_cmd->buttons & IN_MOVELEFT)
offset = *charge_float;
if (current_user_cmd->buttons & IN_MOVERIGHT)
offset = -*charge_float;
current_user_cmd->viewangles.y += offset;
});
static settings::Bool autosapper_enabled( "autosapper.enabled", "false");
static settings::Bool autosapper_silent( "autosapper.silent", "true");
static settings::Bool autosapper_enabled("autosapper.enabled", "false");
static settings::Bool autosapper_silent("autosapper.silent", "true");
static HookedFunction SapperAimbot(HF_CreateMove, "sapperaimbot", 5, [](){
static HookedFunction SapperAimbot(HF_CreateMove, "sapperaimbot", 5, []() {
if (!autosapper_enabled)
return;
if (CE_BAD(LOCAL_E) || CE_BAD(LOCAL_W) || !g_pLocalPlayer->holding_sapper)
return;
CachedEntity *target = nullptr;
float fov = FLT_MAX;
float fov = FLT_MAX;
float range = re::C_TFWeaponBaseMelee::GetSwingRange(RAW_ENT(LOCAL_W));
for (int i = 0; i < entity_cache::max; i++)
{
@ -272,16 +271,18 @@ static HookedFunction SapperAimbot(HF_CreateMove, "sapperaimbot", 5, [](){
continue;
if (GetBuildingPosition(ent).DistTo(g_pLocalPlayer->v_Eye) > range)
continue;
float new_fov = GetFov(g_pLocalPlayer->v_OrigViewangles, g_pLocalPlayer->v_Eye, GetBuildingPosition(ent));
float new_fov = GetFov(g_pLocalPlayer->v_OrigViewangles,
g_pLocalPlayer->v_Eye, GetBuildingPosition(ent));
if (fov <= new_fov)
continue;
fov = new_fov;
fov = new_fov;
target = ent;
}
if (target)
{
AimAt(g_pLocalPlayer->v_Eye, GetBuildingPosition(target), current_user_cmd);
AimAt(g_pLocalPlayer->v_Eye, GetBuildingPosition(target),
current_user_cmd);
if (autosapper_silent)
g_pLocalPlayer->bUseSilentAngles = true;
current_user_cmd->buttons |= IN_ATTACK;

View File

@ -367,7 +367,7 @@ void createMove()
if (random_order && source->size())
{
current_index = rand() % source->size();
int tries = 0;
int tries = 0;
while (current_index == last_index && tries++ < 1000)
{
current_index = rand() % source->size();

View File

@ -589,7 +589,7 @@ float EffectiveTargetingRange()
// Pyros only have so much untill their flames hit
else if (g_pLocalPlayer->weapon()->m_iClassID() ==
CL_CLASS(CTFFlameThrower))
return 200.0f;
return 300.0f;
// If user has set a max range, then use their setting,
if (max_range)
return *max_range;