From 6e8c2106d42bd32731b87d3b66e653055f2670b3 Mon Sep 17 00:00:00 2001 From: gir489 <100792176+gir489returns@users.noreply.github.com> Date: Fri, 26 Jul 2024 05:07:28 -0400 Subject: [PATCH] Added an option to the aimbot to make it retrieve the max distance for the current weapon. (#3430) Fixed an exception coming from spoof_host_token if a pointer was invalid. Fixed the aimbot targeting "friendly NPCs" who were for some reason marked as hated NPC relationships. --- .../looped/session/spoof_host_token.cpp | 6 ++++-- src/backend/looped/weapons/aimbot.cpp | 18 +++++++++++++++--- src/backend/looped/weapons/triggerbot.cpp | 2 +- src/core/settings.hpp | 1 + src/views/self/view_weapons.cpp | 6 ++++++ 5 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/backend/looped/session/spoof_host_token.cpp b/src/backend/looped/session/spoof_host_token.cpp index ccc57db1..25f1204f 100644 --- a/src/backend/looped/session/spoof_host_token.cpp +++ b/src/backend/looped/session/spoof_host_token.cpp @@ -19,7 +19,8 @@ namespace big g_pointers->m_gta.m_profile_gamer_info->m_peer_id = *g_pointers->m_gta.m_peer_id; g_pointers->m_gta.m_player_info_gamer_info->m_peer_id = *g_pointers->m_gta.m_peer_id; - (*g_pointers->m_gta.m_communications)->m_voice.m_connections[0]->m_gamer_info.m_peer_id = *g_pointers->m_gta.m_peer_id; + if (g_pointers->m_gta.m_communications != nullptr) + (*g_pointers->m_gta.m_communications)->m_voice.m_connections[0]->m_gamer_info.m_peer_id = *g_pointers->m_gta.m_peer_id; if (g_local_player && g_local_player->m_player_info) g_local_player->m_player_info->m_net_player_data.m_peer_id = *g_pointers->m_gta.m_peer_id; @@ -36,7 +37,8 @@ namespace big g_pointers->m_gta.m_profile_gamer_info->m_host_token = token; g_pointers->m_gta.m_player_info_gamer_info->m_host_token = token; - (*g_pointers->m_gta.m_communications)->m_voice.m_connections[0]->m_gamer_info.m_host_token = token; + if (g_pointers->m_gta.m_communications != nullptr) + (*g_pointers->m_gta.m_communications)->m_voice.m_connections[0]->m_gamer_info.m_host_token = token; if (g_local_player && g_local_player->m_player_info) g_local_player->m_player_info->m_net_player_data.m_host_token = token; diff --git a/src/backend/looped/weapons/aimbot.cpp b/src/backend/looped/weapons/aimbot.cpp index b09ac914..b8b46965 100644 --- a/src/backend/looped/weapons/aimbot.cpp +++ b/src/backend/looped/weapons/aimbot.cpp @@ -119,6 +119,17 @@ namespace big float best_fov = math::deg_to_rad(g.weapons.aimbot.fov); float best_distance = g.weapons.aimbot.distance; + if (g.weapons.aimbot.use_weapon_range) + { + if (auto weapon_manager = g_local_player->m_weapon_manager) + { + if (auto weapon_info = weapon_manager->m_weapon_info) + { + best_distance = weapon_info->m_weapon_range; + } + } + } + for (rage::CEntity* ped_ : pools::get_all_peds()) { CPed* ped = (CPed*)ped_; @@ -163,15 +174,16 @@ namespace big { case Dislike: case Wanted: - case Hate: is_hated_relationship = true; + case Hate: is_hated_relationship = blip_color != HUD_COLOUR_BLUE; } if (!is_hated_relationship && !is_in_combat && !is_enemy) { - /*if (PED::GET_PED_TYPE(ped_handle) != PED_TYPE_ANIMAL) - LOG(INFO) << " PED_TYPE " << PED::GET_PED_TYPE(ped_handle) << " hated " << is_hated_relationship << " combat " << is_in_combat << " enemy " << is_enemy << " blip_color " << blip_color;*/ continue; } + + /*if (PED::GET_PED_TYPE(ped_handle) != PED_TYPE_ANIMAL) + LOG(INFO) << " PED_TYPE " << PED::GET_PED_TYPE(ped_handle) << " hated " << is_hated_relationship << " combat " << is_in_combat << " enemy " << is_enemy << " blip_color " << blip_color;*/ } if (is_a_ped_type_we_dont_care_about(ped_handle)) diff --git a/src/backend/looped/weapons/triggerbot.cpp b/src/backend/looped/weapons/triggerbot.cpp index c25985a1..1c2c6a52 100644 --- a/src/backend/looped/weapons/triggerbot.cpp +++ b/src/backend/looped/weapons/triggerbot.cpp @@ -55,7 +55,7 @@ namespace big { case Dislike: case Wanted: - case Hate: is_hated_relationship = true; + case Hate: is_hated_relationship = blip_color != HUD_COLOUR_BLUE; } if (!is_hated_relationship && !is_in_combat && !is_enemy) diff --git a/src/core/settings.hpp b/src/core/settings.hpp index d61a9b78..4ba3506c 100644 --- a/src/core/settings.hpp +++ b/src/core/settings.hpp @@ -904,6 +904,7 @@ namespace big bool exclude_friends = false; bool only_on_enemy = false; bool has_target = false; + bool use_weapon_range = false; float fov = 60.f; float distance = 200.f; int32_t selected_bone = (int32_t)ePedBoneType::HEAD; diff --git a/src/views/self/view_weapons.cpp b/src/views/self/view_weapons.cpp index 9692afea..98e185ec 100644 --- a/src/views/self/view_weapons.cpp +++ b/src/views/self/view_weapons.cpp @@ -225,7 +225,13 @@ namespace big ImGui::PushItemWidth(350); ImGui::SliderFloat("VIEW_WEAPON_AIM_FOV"_T.data(), &g.weapons.aimbot.fov, 1.f, 360.f, "%.0f"); + if (g.weapons.aimbot.use_weapon_range) + ImGui::BeginDisabled(); ImGui::SliderFloat("VIEW_SELF_CUSTOM_TELEPORT_DISTANCE"_T.data(), &g.weapons.aimbot.distance, 1.f, 1000.f, "%.0f"); + ImGui::SameLine(); + if (g.weapons.aimbot.use_weapon_range) + ImGui::EndDisabled(); + ImGui::Checkbox("BACKEND_LOOPED_WEAPONS_USE_MAX_RANGE"_T.data(), &g.weapons.aimbot.use_weapon_range); ImGui::PopItemWidth(); }