mirror of
https://github.com/YimMenu/YimMenuV2.git
synced 2026-10-10 03:43:15 +08:00
fix(aimbot): ensure we pick another target after the existing one is dead
This commit is contained in:
@@ -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<Misc::AssistedAimShouldReleaseEntity, DetourHook<decltype(&Misc::AssistedAimShouldReleaseEntity)>>()->Original()(a1);
|
||||
|
||||
@@ -384,6 +384,11 @@ namespace YimMenu
|
||||
AssistedAimShouldReleaseEntity = ptr.Sub(0xF).As<PVOID>();
|
||||
});
|
||||
|
||||
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<Functions::AssistedAimFindNewTarget>();
|
||||
});
|
||||
|
||||
if (!scanner.Scan())
|
||||
{
|
||||
LOG(FATAL) << "Some patterns could not be found, unloading.";
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user