From 691e478268d4abbd28357766a4a9bfaf8348b274 Mon Sep 17 00:00:00 2001 From: julianacat Date: Sat, 1 Jul 2017 16:13:59 -0500 Subject: [PATCH 1/6] Comprimised with wip should aim system --- src/hacks/Aimbot.cpp | 66 +++++++++++++++++++++++++++++++++----------- src/hacks/Aimbot.h | 2 +- 2 files changed, 51 insertions(+), 17 deletions(-) diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index c56e83d3..ecd7958f 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -68,7 +68,6 @@ static CatEnum hitbox_enum({ static CatVar hitbox(hitbox_enum, "aimbot_hitbox", "0", "Hitbox", "Hitbox to aim at. Ignored if AutoHitbox is on"); static CatVar zoomed_only(CV_SWITCH, "aimbot_zoomed", "1", "Zoomed only", "Don't autoshoot with unzoomed rifles"); static CatVar only_can_shoot(CV_SWITCH, "aimbot_only_when_can_shoot", "1", "Active when can shoot", "Aimbot only activates when you can instantly shoot, sometimes making the autoshoot invisible for spectators"); -static CatVar only_can_shoot_wip(CV_SWITCH, "aimbot_only_when_can_shoot_wip", "0", "When can shoot", "Aimbot only activates when you can instantly shoot, sometimes making the autoshoot invisible for spectators\nNew version that fixes some bugs, but introduces others\nEnable with other option to enable"); static CatVar attack_only(CV_SWITCH, "aimbot_enable_attack_only", "0", "Active when attacking", "Basically makes Mouse1 an AimKey, isn't compatible with AutoShoot"); static CatVar max_range(CV_INT, "aimbot_maxrange", "0", "Max distance", "Max range for aimbot\n" @@ -152,14 +151,14 @@ void CreateMove() { // Only allow aimbot to work with aimkey // We also preform a CanShoot check here per the old canshoot method - if (UpdateAimkey() && ShouldAimLeg()) { + if (UpdateAimkey() && GetCanAim(1)) { // Check if player isnt using a huntsman if (g_pLocalPlayer->weapon()->m_iClassID != CL_CLASS(CTFCompoundBow)) { // If settings allow, limit aiming to only when can shoot // We do this here only if wip is true as we do the check elsewhere for legacy - if (only_can_shoot && only_can_shoot_wip) { + if (GetCanAim(2)) { // Check the flNextPrimaryAttack netvar to tell when to aim if (CanShoot()) Aim(target); } else { @@ -809,20 +808,55 @@ bool UpdateAimkey() { // Return whether the aimkey allows aiming return allowAimkey; } + +// A function called at 2 points in the create move function +// First time is when the aimbot Determines if it should aim and autoshoot +// Second time is for when the aimbot determines only when it should aim and always autoshoots +// Using either mode has problems with some weapons so we compramise by using a combo of the 2 +bool GetCanAim(int mode) { -// Function of previous CanShoot check -bool ShouldAimLeg() { - // If user settings allow, we preform out canshoot here - if (only_can_shoot && !only_can_shoot_wip) { - // Miniguns should shoot and aim continiously. TODO smg - if (g_pLocalPlayer->weapon()->m_iClassID != CL_CLASS(CTFMinigun)) { - // Melees are weird, they should aim continiously like miniguns too. - if (GetWeaponMode() != weaponmode::weapon_melee) { - // Finally, CanShoot() check. - if (!CanShoot()) return false; - } - } - } + // User setting check + switch (mode) { + case 1: // The first check when the aimbot checks if it can aim or shoot + + // If user settings dont allow, Always aim at the point this is called + if (!only_can_shoot) return true; + // Always aim with melee weapons + if (GetWeaponMode() == weaponmode::weapon_melee) return true; + break; + + case 2: // Second check when the aimbot checks if it can aim, and will shoot regardless of the output here + + // dont check if should aim with melee weapons + if (GetWeaponMode() == weaponmode::weapon_melee) return false; + + // At the point this is called, we dont want to check for can shoot if user settings dont allow + if (!only_can_shoot) return false; + } + + // Weapons that should attack continuously + bool using_wep_on_list = + g_pLocalPlayer->weapon()->m_iClassID == CL_CLASS(CTFPistol_Scout) || + g_pLocalPlayer->weapon()->m_iClassID == CL_CLASS(CTFMinigun) || + g_pLocalPlayer->weapon()->m_iClassID == CL_CLASS(CTFSyringeGun) || + g_pLocalPlayer->weapon()->m_iClassID == CL_CLASS(CTFSMG) || + g_pLocalPlayer->weapon()->m_iClassID == CL_CLASS(CTFRevolver) || + g_pLocalPlayer->weapon()->m_iClassID == CL_CLASS(CTFFlameThrower); + + switch (mode) { + case 1: // The first check when the aimbot checks if it can aim or shoot + + // If the player isnt using these weaps, then check for can shoot. If the weapon isnt on the list, then we need to check if the player should aim here and return the result + if (!using_wep_on_list) return CanShoot(); + break; + + case 2: // Second check when the aimbot checks if it can aim, and will shoot regardless of the output here + + // Return whether we are using one of the weapons on the list because we want to tell the aimbot that we should check for canshoot + return using_wep_on_list; + } + + // Mode wasnt input correctly, just return true and hope for the best return true; } diff --git a/src/hacks/Aimbot.h b/src/hacks/Aimbot.h index 04737f9f..a501b7c1 100644 --- a/src/hacks/Aimbot.h +++ b/src/hacks/Aimbot.h @@ -58,7 +58,7 @@ int BestHitbox(CachedEntity* target); int ClosestHitbox(CachedEntity* target); void slowAim(Vector &inputAngle, Vector userAngle); bool UpdateAimkey(); -bool ShouldAimLeg(); +bool GetCanAim(int mode); }}} From 144f202e1a21f81a22f68705811b0a4815b038ba Mon Sep 17 00:00:00 2001 From: julianacat Date: Sat, 1 Jul 2017 16:17:03 -0500 Subject: [PATCH 2/6] Updated menu --- tf-settings/menu.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tf-settings/menu.json b/tf-settings/menu.json index 20d2557f..f3b1178a 100644 --- a/tf-settings/menu.json +++ b/tf-settings/menu.json @@ -47,6 +47,7 @@ "aimbot_only_when_can_shoot", "aimbot_enable_attack_only", "aimbot_maxrange", + "aimbot_fov_draw", "aimbot_slow", "aimbot_slow_smooth", "aimbot_slow_autoshoot", @@ -334,6 +335,7 @@ "list": [ "chat_newlines", "clean_chat", + "chat_crypto", "killsay", "killsay_file", "spam", @@ -444,7 +446,6 @@ "debug_ve_averaging", "no_visuals", "aimbot_debug", - "aimbot_only_when_can_shoot_wip", "debug_info", "log", "setupbones_time", From 04fed82e7689b679b1b3486a977adca380474050 Mon Sep 17 00:00:00 2001 From: julianacat Date: Sun, 2 Jul 2017 02:00:16 -0500 Subject: [PATCH 3/6] Fixed canshoot func location --- src/hacks/Aimbot.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index ecd7958f..c6f6f9e1 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -121,9 +121,6 @@ void CreateMove() { // Check if aimbot is enabled if (!enabled) return; - // Check if player can aim - if (!ShouldAim()) return; - // Refresh projectile info int huntsman_ticks = 0; projectile_mode = (GetProjectileData(g_pLocalPlayer->weapon(), cur_proj_speed, cur_proj_grav)); @@ -149,9 +146,9 @@ void CreateMove() { hacks::shared::esp::SetEntityColor(target, colors::pink); last_target = target->m_IDX; - // Only allow aimbot to work with aimkey + // Check if player can aim // We also preform a CanShoot check here per the old canshoot method - if (UpdateAimkey() && GetCanAim(1)) { + if (ShouldAim() && GetCanAim(1)) { // Check if player isnt using a huntsman if (g_pLocalPlayer->weapon()->m_iClassID != CL_CLASS(CTFCompoundBow)) { @@ -215,6 +212,8 @@ bool ShouldAim() { if (attack_only && !(g_pUserCmd->buttons & IN_ATTACK)) { return false; } + // Check if aimkey allows aiming + if (!UpdateAimkey()) return false; // Check for +use if (g_pUserCmd->buttons & IN_USE) return false; // Check if using action slot item From 8ced27574960718766d88b7079f9c0b95c401ad1 Mon Sep 17 00:00:00 2001 From: julianacat Date: Sun, 2 Jul 2017 02:05:40 -0500 Subject: [PATCH 4/6] Fix potential crash --- src/hacks/Aimbot.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index c6f6f9e1..6f8db72c 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -100,8 +100,7 @@ static CatVar auto_zoom(CV_SWITCH, "aimbot_auto_zoom", "0", "Auto Zoom", "Automa // Current Entity int target_eid { 0 }; CachedEntity* target = 0; -CachedEntity* target_locked = 0; -int last_target { -1 }; +CachedEntity* target_last = 0; bool foundTarget = false; // Projectile info bool projectile_mode { false }; @@ -144,7 +143,6 @@ void CreateMove() { if (CE_GOOD(target) && foundTarget) { // Set target esp color to pink hacks::shared::esp::SetEntityColor(target, colors::pink); - last_target = target->m_IDX; // Check if player can aim // We also preform a CanShoot check here per the old canshoot method @@ -271,15 +269,18 @@ CachedEntity* RetrieveBestTarget() { // If we have a previously chosen target, target lock is on, and the aimkey is allowed, then attemt to keep the previous target if (target_lock && foundTarget && UpdateAimkey()) { - // Check if previous target is still good - if (IsTargetStateGood(target_locked)) { - // If it is then return it again - return target_locked; + if (CE_GOOD(target_last)) { + // Check if previous target is still good + if (IsTargetStateGood(target_last)) { + // If it is then return it again + return target_locked; + } } } - // We dont have a target currently so we must find one + // We dont have a target currently so we must find one, reset statuses foundTarget = false; + target_last = -1; // Book keeping vars float target_highest_score, scr; @@ -321,7 +322,7 @@ CachedEntity* RetrieveBestTarget() { } } // Save the ent for future use with target lock - target_locked = target_highest_ent; + target_last = target_highest_ent; // When our for loop finishes, return our ent return target_highest_ent; } @@ -883,7 +884,7 @@ CachedEntity* CurrentTarget() { // Used for when you join and leave maps to reset aimbot vars void Reset() { - last_target = -1; + target_last = -1; projectile_mode = false; } From afc32b6a1f9f155ca34da97041ae86652f7fced2 Mon Sep 17 00:00:00 2001 From: julianacat Date: Sun, 2 Jul 2017 02:27:08 -0500 Subject: [PATCH 5/6] stuff --- src/hacks/Aimbot.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index 6f8db72c..bf6d4920 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -120,6 +120,10 @@ void CreateMove() { // Check if aimbot is enabled if (!enabled) return; + // Save should aim info + bool shouldAim = ShouldAim(); + bool aimkeyStatus = UpdateAimkey(); + // Refresh projectile info int huntsman_ticks = 0; projectile_mode = (GetProjectileData(g_pLocalPlayer->weapon(), cur_proj_speed, cur_proj_grav)); @@ -137,16 +141,16 @@ void CreateMove() { } // Refresh our best target - CachedEntity* target = RetrieveBestTarget(); + CachedEntity* target = RetrieveBestTarget(aimkeyStatus); // Check target for dormancy and if there even is a target at all if (CE_GOOD(target) && foundTarget) { // Set target esp color to pink hacks::shared::esp::SetEntityColor(target, colors::pink); - // Check if player can aim + // Check if player can aim and if aimkey allows aiming // We also preform a CanShoot check here per the old canshoot method - if (ShouldAim() && GetCanAim(1)) { + if (shouldAim && UpdateAimkey() && GetCanAim(1)) { // Check if player isnt using a huntsman if (g_pLocalPlayer->weapon()->m_iClassID != CL_CLASS(CTFCompoundBow)) { @@ -210,8 +214,6 @@ bool ShouldAim() { if (attack_only && !(g_pUserCmd->buttons & IN_ATTACK)) { return false; } - // Check if aimkey allows aiming - if (!UpdateAimkey()) return false; // Check for +use if (g_pUserCmd->buttons & IN_USE) return false; // Check if using action slot item @@ -265,15 +267,15 @@ bool ShouldAim() { } // Function to find a suitable target -CachedEntity* RetrieveBestTarget() { +CachedEntity* RetrieveBestTarget(bool aimkey) { // If we have a previously chosen target, target lock is on, and the aimkey is allowed, then attemt to keep the previous target - if (target_lock && foundTarget && UpdateAimkey()) { + if (target_lock && foundTarget && aimkey) { if (CE_GOOD(target_last)) { // Check if previous target is still good if (IsTargetStateGood(target_last)) { // If it is then return it again - return target_locked; + return target_last; } } } @@ -813,6 +815,7 @@ bool UpdateAimkey() { // First time is when the aimbot Determines if it should aim and autoshoot // Second time is for when the aimbot determines only when it should aim and always autoshoots // Using either mode has problems with some weapons so we compramise by using a combo of the 2 +// The point of using this function for 2 uses is to not make duplicate funcs for essentialy the same thing bool GetCanAim(int mode) { // User setting check From 79870f6c5cc293329490b0a0e2846e28f032cfc0 Mon Sep 17 00:00:00 2001 From: julianacat Date: Sun, 2 Jul 2017 02:46:05 -0500 Subject: [PATCH 6/6] more fixes --- src/hacks/Aimbot.cpp | 6 +++--- src/hacks/Aimbot.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/hacks/Aimbot.cpp b/src/hacks/Aimbot.cpp index bf6d4920..f7233ce6 100644 --- a/src/hacks/Aimbot.cpp +++ b/src/hacks/Aimbot.cpp @@ -150,7 +150,7 @@ void CreateMove() { // Check if player can aim and if aimkey allows aiming // We also preform a CanShoot check here per the old canshoot method - if (shouldAim && UpdateAimkey() && GetCanAim(1)) { + if (shouldAim && aimkeyStatus && GetCanAim(1)) { // Check if player isnt using a huntsman if (g_pLocalPlayer->weapon()->m_iClassID != CL_CLASS(CTFCompoundBow)) { @@ -267,10 +267,10 @@ bool ShouldAim() { } // Function to find a suitable target -CachedEntity* RetrieveBestTarget(bool aimkey) { +CachedEntity* RetrieveBestTarget(bool aimkey_state) { // If we have a previously chosen target, target lock is on, and the aimkey is allowed, then attemt to keep the previous target - if (target_lock && foundTarget && aimkey) { + if (target_lock && foundTarget && aimkey_state) { if (CE_GOOD(target_last)) { // Check if previous target is still good if (IsTargetStateGood(target_last)) { diff --git a/src/hacks/Aimbot.h b/src/hacks/Aimbot.h index a501b7c1..19261622 100644 --- a/src/hacks/Aimbot.h +++ b/src/hacks/Aimbot.h @@ -50,7 +50,7 @@ float EffectiveTargetingRange(); CachedEntity* CurrentTarget(); bool ShouldAim(); -CachedEntity* RetrieveBestTarget(); +CachedEntity* RetrieveBestTarget(bool aimkey_state); bool IsTargetStateGood(CachedEntity* entity); void Aim(CachedEntity* entity); bool CanAutoShoot();