From e298330a2ffd1b6b87038f8629f3e4a8560fd5e0 Mon Sep 17 00:00:00 2001 From: maybegreat48 <96936658+maybegreat48@users.noreply.github.com> Date: Sat, 7 Jun 2025 16:00:28 -0400 Subject: [PATCH] fix(aimbot): ensure we pick another target after the existing one is dead --- src/game/hooks/Misc/AssistedAimShouldReleaseEntity.cpp | 8 +++++++- src/game/pointers/Pointers.cpp | 5 +++++ src/game/pointers/Pointers.hpp | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/game/hooks/Misc/AssistedAimShouldReleaseEntity.cpp b/src/game/hooks/Misc/AssistedAimShouldReleaseEntity.cpp index d7c8f6f..411af15 100644 --- a/src/game/hooks/Misc/AssistedAimShouldReleaseEntity.cpp +++ b/src/game/hooks/Misc/AssistedAimShouldReleaseEntity.cpp @@ -2,6 +2,7 @@ #include "game/hooks/Hooks.hpp" #include "types/entity/CDynamicEntity.hpp" #include "game/gta/Ped.hpp" +#include "game/pointers/Pointers.hpp" namespace YimMenu::Hooks { @@ -11,7 +12,12 @@ namespace YimMenu::Hooks if (entity && entity->IsPed() && Ped(entity).IsDead()) { - return true; + *(CDynamicEntity**)(a1 + 0x38) = nullptr; + if (!Pointers.AssistedAimFindNewTarget(a1)) + { + *(CDynamicEntity**)(a1 + 0x38) = entity; // failed, restore original entity to avoid issues + return true; + } } return BaseHook::Get>()->Original()(a1); diff --git a/src/game/pointers/Pointers.cpp b/src/game/pointers/Pointers.cpp index 6f4dfcd..77deeeb 100644 --- a/src/game/pointers/Pointers.cpp +++ b/src/game/pointers/Pointers.cpp @@ -384,6 +384,11 @@ namespace YimMenu AssistedAimShouldReleaseEntity = ptr.Sub(0xF).As(); }); + constexpr auto assistedAimFindNewTargetPtrn = Pattern<"0F 84 C9 00 00 00 48 89 CE 48 89 F9">("AssistedAimFindNewTarget"); + scanner.Add(assistedAimFindNewTargetPtrn, [this](PointerCalculator ptr) { + AssistedAimFindNewTarget = ptr.Sub(0x33).As(); + }); + if (!scanner.Scan()) { LOG(FATAL) << "Some patterns could not be found, unloading."; diff --git a/src/game/pointers/Pointers.hpp b/src/game/pointers/Pointers.hpp index 2a34c41..0fd8d90 100644 --- a/src/game/pointers/Pointers.hpp +++ b/src/game/pointers/Pointers.hpp @@ -65,6 +65,7 @@ namespace YimMenu using GetSessionByGamerHandle = bool (*)(int profile_index, rage::rlGamerHandle* handles, int num_handles, rage::rlSessionByGamerTaskResult* results, int num_results, bool* success, rage::rlTaskStatus* state); using GetPresenceAttributes = bool (*)(int profile_index, rage::rlScGamerHandle* handles, int num_handles, rage::rlQueryPresenceAttributesContext** contexts, int count, rage::rlScTaskStatus* state); using GetAvatars = bool (*)(rage::rlGetAvatarsContext* context, rage::rlGetAvatarsPlayerList* players); + using AssistedAimFindNewTarget = bool(*)(__int64 a1); } struct PointerData @@ -151,6 +152,7 @@ namespace YimMenu int* HasGTAPlus; PVOID BattlEyeServerProcessPlayerJoin; PVOID AssistedAimShouldReleaseEntity; + Functions::AssistedAimFindNewTarget AssistedAimFindNewTarget; }; struct Pointers : PointerData