Improve Warp, Demoknight aim, and crithack
This commit is contained in:
parent
c549898434
commit
3696e1df75
@ -8,6 +8,7 @@ extern settings::Boolean melee;
|
|||||||
extern std::vector<int> crit_cmds;
|
extern std::vector<int> crit_cmds;
|
||||||
extern int current_index;
|
extern int current_index;
|
||||||
extern bool isEnabled();
|
extern bool isEnabled();
|
||||||
|
extern bool force_crit_this_tick;
|
||||||
void fixBucket(IClientEntity *weapon, CUserCmd *cmd);
|
void fixBucket(IClientEntity *weapon, CUserCmd *cmd);
|
||||||
|
|
||||||
class weapon_info
|
class weapon_info
|
||||||
|
@ -46,10 +46,10 @@ static bool isRapidFire(IClientEntity *wep)
|
|||||||
return ret || wep->GetClientClass()->m_ClassID == CL_CLASS(CTFMinigun);
|
return ret || wep->GetClientClass()->m_ClassID == CL_CLASS(CTFMinigun);
|
||||||
}
|
}
|
||||||
|
|
||||||
static float getBucketCap()
|
static int getBucketCap()
|
||||||
{
|
{
|
||||||
static ConVar *tf_weapon_criticals_bucket_cap = g_ICvar->FindVar("tf_weapon_criticals_bucket_cap");
|
static ConVar *tf_weapon_criticals_bucket_cap = g_ICvar->FindVar("tf_weapon_criticals_bucket_cap");
|
||||||
return tf_weapon_criticals_bucket_cap->GetFloat();
|
return tf_weapon_criticals_bucket_cap->GetInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
static float getWithdrawMult(IClientEntity *wep)
|
static float getWithdrawMult(IClientEntity *wep)
|
||||||
@ -64,7 +64,7 @@ static float getWithdrawMult(IClientEntity *wep)
|
|||||||
if (g_pLocalPlayer->weapon_mode != weapon_melee)
|
if (g_pLocalPlayer->weapon_mode != weapon_melee)
|
||||||
flMultiply = RemapValClamped(((float) call_count / (float) crit_checks), 0.1f, 1.f, 1.f, 3.f);
|
flMultiply = RemapValClamped(((float) call_count / (float) crit_checks), 0.1f, 1.f, 1.f, 3.f);
|
||||||
|
|
||||||
float flToRemove = flMultiply * 3.0;
|
float flToRemove = flMultiply * 3.0f;
|
||||||
return flToRemove;
|
return flToRemove;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -84,10 +84,10 @@ static bool isAllowedToWithdrawFromBucket(IClientEntity *wep, float flDamage, bo
|
|||||||
if (isRapidFire(wep))
|
if (isRapidFire(wep))
|
||||||
flToRemove = taken_per_crit * getWithdrawMult(wep);
|
flToRemove = taken_per_crit * getWithdrawMult(wep);
|
||||||
// Can remove
|
// Can remove
|
||||||
if (flToRemove <= info.crit_bucket)
|
if (flToRemove > info.crit_bucket)
|
||||||
return true;
|
return false;
|
||||||
|
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This simulates a shot in all the important aspects, like increating crit attempts, bucket, etc
|
// This simulates a shot in all the important aspects, like increating crit attempts, bucket, etc
|
||||||
@ -245,8 +245,9 @@ static bool randomCritEnabled()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// These are used when we want to force a crit regardless of states (e.g. for delayed weapons like sticky launchers)
|
// These are used when we want to force a crit regardless of states (e.g. for delayed weapons like sticky launchers)
|
||||||
static int force_ticks = 0;
|
static int force_ticks = 0;
|
||||||
static int prevent_ticks = 0;
|
static int prevent_ticks = 0;
|
||||||
|
bool force_crit_this_tick = false;
|
||||||
|
|
||||||
// Is the hack enabled?
|
// Is the hack enabled?
|
||||||
bool isEnabled()
|
bool isEnabled()
|
||||||
@ -306,7 +307,7 @@ bool prevent_crit()
|
|||||||
void force_crit()
|
void force_crit()
|
||||||
{
|
{
|
||||||
// Crithack should not run
|
// Crithack should not run
|
||||||
if (!isEnabled() && !preventCrits())
|
if (!isEnabled() && !force_crit_this_tick && !preventCrits())
|
||||||
return;
|
return;
|
||||||
// Can't crit
|
// Can't crit
|
||||||
if (!added_per_shot)
|
if (!added_per_shot)
|
||||||
@ -319,7 +320,7 @@ void force_crit()
|
|||||||
if (g_pLocalPlayer->weapon_mode != weapon_melee && LOCAL_W->m_iClassID() != CL_CLASS(CTFPipebombLauncher))
|
if (g_pLocalPlayer->weapon_mode != weapon_melee && LOCAL_W->m_iClassID() != CL_CLASS(CTFPipebombLauncher))
|
||||||
{
|
{
|
||||||
// Force to not crit
|
// Force to not crit
|
||||||
if (crit_key && !crit_key.isKeyDown())
|
if (!force_crit_this_tick && crit_key && !crit_key.isKeyDown())
|
||||||
{
|
{
|
||||||
// Prevent Crit
|
// Prevent Crit
|
||||||
prevent_crit();
|
prevent_crit();
|
||||||
@ -337,7 +338,7 @@ void force_crit()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// We can just force to nearest crit for melee, and sticky launchers apparently
|
// We can just force to nearest crit for melee, and sticky launchers apparently
|
||||||
else if ((g_pLocalPlayer->weapon_mode == weapon_melee && melee) || (LOCAL_W->m_iClassID() == CL_CLASS(CTFPipebombLauncher) && enabled))
|
else if ((g_pLocalPlayer->weapon_mode == weapon_melee && (melee || force_crit_this_tick)) || (LOCAL_W->m_iClassID() == CL_CLASS(CTFPipebombLauncher) && (force_crit_this_tick || enabled)))
|
||||||
{
|
{
|
||||||
int next_crit = nextCritTick();
|
int next_crit = nextCritTick();
|
||||||
if (next_crit != -1)
|
if (next_crit != -1)
|
||||||
@ -349,7 +350,7 @@ void force_crit()
|
|||||||
if (force_ticks)
|
if (force_ticks)
|
||||||
force_ticks--;
|
force_ticks--;
|
||||||
// Prevent crits
|
// Prevent crits
|
||||||
if (!prevent_ticks && !force_ticks && preventCrits())
|
if (!force_crit_this_tick && !prevent_ticks && !force_ticks && preventCrits())
|
||||||
prevent_ticks = 3;
|
prevent_ticks = 3;
|
||||||
if (prevent_ticks)
|
if (prevent_ticks)
|
||||||
{
|
{
|
||||||
@ -359,7 +360,7 @@ void force_crit()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Code for handling when to not crit with melee weapons
|
// Code for handling when to not crit with melee weapons
|
||||||
else if (force_no_crit)
|
else if (force_no_crit && !force_crit_this_tick)
|
||||||
{
|
{
|
||||||
if (hacks::shared::backtrack::isBacktrackEnabled)
|
if (hacks::shared::backtrack::isBacktrackEnabled)
|
||||||
{
|
{
|
||||||
@ -397,6 +398,7 @@ void force_crit()
|
|||||||
current_late_user_cmd->random_seed = MD5_PseudoRandom(next_crit) & 0x7FFFFFFF;
|
current_late_user_cmd->random_seed = MD5_PseudoRandom(next_crit) & 0x7FFFFFFF;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
force_crit_this_tick = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the magic crit commands numbers
|
// Update the magic crit commands numbers
|
||||||
@ -492,7 +494,7 @@ static void updateCmds()
|
|||||||
|
|
||||||
// Never try to drain more than cap
|
// Never try to drain more than cap
|
||||||
if (taken_per_crit * 3.0f > getBucketCap())
|
if (taken_per_crit * 3.0f > getBucketCap())
|
||||||
taken_per_crit = getBucketCap() / 3.0f;
|
taken_per_crit = (float) getBucketCap() / 3.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// We found a cmd, store it
|
// We found a cmd, store it
|
||||||
@ -580,9 +582,9 @@ void CreateMove()
|
|||||||
|
|
||||||
// Update magic crit commands
|
// Update magic crit commands
|
||||||
updateCmds();
|
updateCmds();
|
||||||
if (!enabled && !melee)
|
if (!enabled && !force_crit_this_tick && !melee)
|
||||||
return;
|
return;
|
||||||
if (!force_ticks && (!(melee && g_pLocalPlayer->weapon_mode == weapon_melee) && !force_no_crit && crit_key && !crit_key.isKeyDown()))
|
if (!force_ticks && !force_crit_this_tick && (!(melee && g_pLocalPlayer->weapon_mode == weapon_melee) && !force_no_crit && crit_key && !crit_key.isKeyDown()))
|
||||||
return;
|
return;
|
||||||
if (!current_late_user_cmd->command_number)
|
if (!current_late_user_cmd->command_number)
|
||||||
return;
|
return;
|
||||||
|
@ -19,7 +19,7 @@ float sandwich_speed = 350.0f;
|
|||||||
float grav = 0.25f;
|
float grav = 0.25f;
|
||||||
int prevent = -1;
|
int prevent = -1;
|
||||||
|
|
||||||
std::pair<CachedEntity *, Vector> FindBestEnt(bool teammate, bool Predict, bool zcheck)
|
std::pair<CachedEntity *, Vector> FindBestEnt(bool teammate, bool Predict, bool zcheck, bool fov_check)
|
||||||
{
|
{
|
||||||
CachedEntity *bestent = nullptr;
|
CachedEntity *bestent = nullptr;
|
||||||
float bestscr = FLT_MAX;
|
float bestscr = FLT_MAX;
|
||||||
@ -47,8 +47,10 @@ std::pair<CachedEntity *, Vector> FindBestEnt(bool teammate, bool Predict, bool
|
|||||||
if (zcheck && (ent->m_vecOrigin().z - LOCAL_E->m_vecOrigin().z) > 80.0f)
|
if (zcheck && (ent->m_vecOrigin().z - LOCAL_E->m_vecOrigin().z) > 80.0f)
|
||||||
continue;
|
continue;
|
||||||
float scr = ent->m_flDistance();
|
float scr = ent->m_flDistance();
|
||||||
|
if (fov_check)
|
||||||
|
scr = GetFov(g_pLocalPlayer->v_OrigViewangles, g_pLocalPlayer->v_Eye, ent->m_vecOrigin());
|
||||||
if (g_pPlayerResource->GetClass(ent) == tf_medic)
|
if (g_pPlayerResource->GetClass(ent) == tf_medic)
|
||||||
scr *= 0.1f;
|
scr *= 0.5f;
|
||||||
if (scr < bestscr)
|
if (scr < bestscr)
|
||||||
{
|
{
|
||||||
bestent = ent;
|
bestent = ent;
|
||||||
@ -80,8 +82,10 @@ std::pair<CachedEntity *, Vector> FindBestEnt(bool teammate, bool Predict, bool
|
|||||||
if (zcheck && (ent->m_vecOrigin().z - LOCAL_E->m_vecOrigin().z) > 80.0f)
|
if (zcheck && (ent->m_vecOrigin().z - LOCAL_E->m_vecOrigin().z) > 80.0f)
|
||||||
continue;
|
continue;
|
||||||
float scr = ent->m_flDistance();
|
float scr = ent->m_flDistance();
|
||||||
|
if (fov_check)
|
||||||
|
scr = GetFov(g_pLocalPlayer->v_OrigViewangles, g_pLocalPlayer->v_Eye, ent->m_vecOrigin());
|
||||||
if (g_pPlayerResource->GetClass(ent) == tf_medic)
|
if (g_pPlayerResource->GetClass(ent) == tf_medic)
|
||||||
scr *= 0.1f;
|
scr *= 0.5f;
|
||||||
if (scr < bestscr)
|
if (scr < bestscr)
|
||||||
{
|
{
|
||||||
bestent = ent;
|
bestent = ent;
|
||||||
@ -177,7 +181,7 @@ static void SandwichAim()
|
|||||||
Vector Predict;
|
Vector Predict;
|
||||||
CachedEntity *bestent = nullptr;
|
CachedEntity *bestent = nullptr;
|
||||||
std::pair<CachedEntity *, Vector> result{};
|
std::pair<CachedEntity *, Vector> result{};
|
||||||
result = FindBestEnt(true, true, false);
|
result = FindBestEnt(true, true, false, false);
|
||||||
bestent = result.first;
|
bestent = result.first;
|
||||||
Predict = result.second;
|
Predict = result.second;
|
||||||
if (bestent)
|
if (bestent)
|
||||||
@ -209,7 +213,7 @@ static void ChargeAimbot()
|
|||||||
if (!HasCondition<TFCond_Charging>(LOCAL_E))
|
if (!HasCondition<TFCond_Charging>(LOCAL_E))
|
||||||
return;
|
return;
|
||||||
std::pair<CachedEntity *, Vector> result{};
|
std::pair<CachedEntity *, Vector> result{};
|
||||||
result = FindBestEnt(false, false, true);
|
result = FindBestEnt(false, false, true, true);
|
||||||
CachedEntity *bestent = result.first;
|
CachedEntity *bestent = result.first;
|
||||||
if (bestent && result.second.IsValid())
|
if (bestent && result.second.IsValid())
|
||||||
{
|
{
|
||||||
|
@ -221,6 +221,8 @@ void CreateMove()
|
|||||||
{
|
{
|
||||||
case ATTACK:
|
case ATTACK:
|
||||||
{
|
{
|
||||||
|
// Force a crit
|
||||||
|
criticals::force_crit_this_tick = true;
|
||||||
current_user_cmd->buttons |= IN_ATTACK;
|
current_user_cmd->buttons |= IN_ATTACK;
|
||||||
current_state = CHARGE;
|
current_state = CHARGE;
|
||||||
should_warp = false;
|
should_warp = false;
|
||||||
|
Reference in New Issue
Block a user