mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2024-12-22 20:17:24 +08:00
Redesigned triggerbot (#3396)
* Redesigned triggerbot to respect the same configuration the user has setup for the aimbot. Triggerbot will not force fire the player's current weapon instead of just silently spawning a bullet. * Delay grabbing player velocity until after we've confirmed the target velocity has at least one tick of information to use. * Fixed some mission peds not being aimbotted/triggerbotted when using only enemies. Removed unused global. * Refactored enemy checks to only run the enemy determination code if the user has it enabled.
This commit is contained in:
parent
8680d72ecb
commit
1bb96fb562
@ -144,8 +144,13 @@ namespace big
|
||||
|
||||
const auto ped_handle = g_pointers->m_gta.m_ptr_to_handle(ped);
|
||||
|
||||
if (g_aimbot_only_on_enemy.is_enabled())
|
||||
{
|
||||
bool is_hated_relationship = false;
|
||||
bool is_in_combat = PED::IS_PED_IN_COMBAT(ped_handle, self::ped);
|
||||
auto blip_color = HUD::GET_BLIP_COLOUR(HUD::GET_BLIP_FROM_ENTITY(ped_handle));
|
||||
bool is_enemy = PED::GET_PED_CONFIG_FLAG(ped_handle, 38, TRUE) == TRUE || (blip_color == (int)BlipColors::BlipColorEnemy || blip_color == (int)BlipColors::RedMission);
|
||||
|
||||
switch (PED::GET_RELATIONSHIP_BETWEEN_PEDS(ped_handle, self::ped))
|
||||
{
|
||||
case Dislike:
|
||||
@ -153,10 +158,16 @@ namespace big
|
||||
case Hate: is_hated_relationship = true;
|
||||
}
|
||||
|
||||
if ((g_aimbot_only_on_enemy.is_enabled() && (!is_hated_relationship && !is_in_combat)) || is_a_ped_type_we_dont_care_about(ped_handle))
|
||||
if (!is_hated_relationship && !is_in_combat && !is_enemy)
|
||||
{
|
||||
/*if (PED::GET_PED_TYPE(ped_handle) != PED_TYPE_ANIMAL)
|
||||
LOG(INFO) << " is_hated_relationship " << is_hated_relationship << " GET_PED_TYPE " << PED::GET_PED_TYPE(ped_handle) << " is_in_combat " << is_in_combat;*/
|
||||
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 (is_a_ped_type_we_dont_care_about(ped_handle))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -274,12 +285,11 @@ namespace big
|
||||
static void adjust_position_for_target_velocity(rage::fvector3& target_position)
|
||||
{
|
||||
const auto target_velocity = get_velocity(m_target);
|
||||
const auto my_velocity = get_velocity(g_local_player);
|
||||
|
||||
if (target_velocity == rage::fvector3{})
|
||||
return;
|
||||
|
||||
target_position += (target_velocity - my_velocity);
|
||||
target_position += (target_velocity - get_velocity(g_local_player));
|
||||
}
|
||||
|
||||
virtual void on_tick() override
|
||||
@ -321,7 +331,8 @@ namespace big
|
||||
self_pos = *self_ped->get_position();
|
||||
|
||||
aimbot::find_best_target(self_ped, self_pos);
|
||||
if (!aimbot::m_target)
|
||||
g.weapons.aimbot.has_target = aimbot::m_target != nullptr;
|
||||
if (!g.weapons.aimbot.has_target)
|
||||
{
|
||||
goto exit;
|
||||
}
|
||||
|
@ -14,12 +14,92 @@ namespace big
|
||||
Entity crosshair_catch;
|
||||
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_AIM))
|
||||
{
|
||||
if (entity::raycast(&crosshair_catch))
|
||||
if (g.weapons.aimbot.enable && g.weapons.aimbot.has_target)
|
||||
{
|
||||
PED::SET_PED_RESET_FLAG(self::ped, 65, TRUE);
|
||||
}
|
||||
else if (entity::raycast(&crosshair_catch))
|
||||
{
|
||||
if (ENTITY::IS_ENTITY_A_PED(crosshair_catch) && !ENTITY::IS_ENTITY_DEAD(crosshair_catch, 0))
|
||||
{
|
||||
Vector3 coords = ENTITY::GET_ENTITY_BONE_POSTION(crosshair_catch, 0x796E); //SKEL_Head (This will fix the edge case of peds in cars)
|
||||
PED::SET_PED_SHOOTS_AT_COORD(self::ped, coords.x, coords.y, coords.z, true);
|
||||
Ped ped = (Ped)crosshair_catch;
|
||||
CPed* ped_ptr = reinterpret_cast<CPed*>(g_pointers->m_gta.m_handle_to_ptr(ped));
|
||||
|
||||
if (ped_ptr == nullptr)
|
||||
return;
|
||||
|
||||
if (g.weapons.aimbot.only_on_player && !ped_ptr->m_player_info)
|
||||
return;
|
||||
|
||||
if (g.weapons.aimbot.only_on_enemy)
|
||||
{
|
||||
bool is_hated_relationship = false;
|
||||
bool is_in_combat = PED::IS_PED_IN_COMBAT(ped, self::ped);
|
||||
auto blip_color = HUD::GET_BLIP_COLOUR(HUD::GET_BLIP_FROM_ENTITY(ped));
|
||||
bool is_enemy = PED::GET_PED_CONFIG_FLAG(ped, 38, TRUE) == TRUE || (blip_color == (int)BlipColors::BlipColorEnemy || blip_color == (int)BlipColors::RedMission);
|
||||
|
||||
switch (PED::GET_RELATIONSHIP_BETWEEN_PEDS(ped, self::ped))
|
||||
{
|
||||
case Dislike:
|
||||
case Wanted:
|
||||
case Hate: is_hated_relationship = true;
|
||||
}
|
||||
|
||||
if (!is_hated_relationship && !is_in_combat && !is_enemy)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
bool is_a_ped_type_we_dont_care_about;
|
||||
const auto ped_type = PED::GET_PED_TYPE(ped);
|
||||
|
||||
switch (ped_type)
|
||||
{
|
||||
case ePedType::PED_TYPE_PLAYER_0:
|
||||
case ePedType::PED_TYPE_PLAYER_1:
|
||||
case ePedType::PED_TYPE_NETWORK_PLAYER:
|
||||
case ePedType::PED_TYPE_PLAYER_2:
|
||||
case ePedType::PED_TYPE_CIVMALE:
|
||||
case ePedType::PED_TYPE_CIVFEMALE:
|
||||
case ePedType::PED_TYPE_COP:
|
||||
case ePedType::PED_TYPE_GANG_ALBANIAN:
|
||||
case ePedType::PED_TYPE_GANG_BIKER_1:
|
||||
case ePedType::PED_TYPE_GANG_BIKER_2:
|
||||
case ePedType::PED_TYPE_GANG_ITALIAN:
|
||||
case ePedType::PED_TYPE_GANG_RUSSIAN:
|
||||
case ePedType::PED_TYPE_GANG_RUSSIAN_2:
|
||||
case ePedType::PED_TYPE_GANG_IRISH:
|
||||
case ePedType::PED_TYPE_GANG_JAMAICAN:
|
||||
case ePedType::PED_TYPE_GANG_AFRICAN_AMERICAN:
|
||||
case ePedType::PED_TYPE_GANG_KOREAN:
|
||||
case ePedType::PED_TYPE_GANG_CHINESE_JAPANESE:
|
||||
case ePedType::PED_TYPE_GANG_PUERTO_RICAN:
|
||||
case ePedType::PED_TYPE_DEALER:
|
||||
case ePedType::PED_TYPE_MEDIC:
|
||||
case ePedType::PED_TYPE_FIREMAN:
|
||||
case ePedType::PED_TYPE_CRIMINAL:
|
||||
case ePedType::PED_TYPE_BUM:
|
||||
case ePedType::PED_TYPE_PROSTITUTE:
|
||||
case ePedType::PED_TYPE_SPECIAL:
|
||||
case ePedType::PED_TYPE_MISSION:
|
||||
case ePedType::PED_TYPE_SWAT:
|
||||
case ePedType::PED_TYPE_ANIMAL:
|
||||
case ePedType::PED_TYPE_ARMY:
|
||||
{
|
||||
is_a_ped_type_we_dont_care_about = (g.weapons.aimbot.only_on_ped_type & (1LL << ped_type)) == 0;
|
||||
}
|
||||
default: is_a_ped_type_we_dont_care_about = false;
|
||||
}
|
||||
|
||||
if (is_a_ped_type_we_dont_care_about)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//Vector3 coords = ENTITY::GET_ENTITY_BONE_POSTION(crosshair_catch, 0x796E); //SKEL_Head (This will fix the edge case of peds in cars)
|
||||
//PED::SET_PED_SHOOTS_AT_COORD(self::ped, coords.x, coords.y, coords.z, true);
|
||||
PED::SET_PED_RESET_FLAG(self::ped, 65, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ namespace big::scr_globals
|
||||
static inline const script_global mission_creator_radar_follows_camera(2621443);
|
||||
static inline const script_global mission_creator_exited(1574530);
|
||||
|
||||
static inline const script_global in_multiplayer(79389); // g_bInMultiplayer
|
||||
static inline const script_global transition_state(1575011);
|
||||
static inline const script_global sctv_spectator(2697731); // pausemenu_multiplayer function 0xE49C42EC
|
||||
|
||||
|
@ -903,6 +903,7 @@ namespace big
|
||||
int64_t only_on_ped_type = -1;
|
||||
bool only_on_player = false;
|
||||
bool only_on_enemy = false;
|
||||
bool has_target = false;
|
||||
float fov = 60.f;
|
||||
float distance = 200.f;
|
||||
int32_t selected_bone = (int32_t)ePedBoneType::HEAD;
|
||||
|
@ -104,8 +104,7 @@ namespace big::entity
|
||||
bool raycast(Entity* ent)
|
||||
{
|
||||
BOOL hit;
|
||||
Vector3 endCoords;
|
||||
Vector3 surfaceNormal;
|
||||
Vector3 dontCare;
|
||||
|
||||
Vector3 camCoords = CAM::GET_GAMEPLAY_CAM_COORD();
|
||||
Vector3 rot = CAM::GET_GAMEPLAY_CAM_ROT(2);
|
||||
@ -116,7 +115,7 @@ namespace big::entity
|
||||
farCoords.y = camCoords.y + dir.y * 1000;
|
||||
farCoords.z = camCoords.z + dir.z * 1000;
|
||||
|
||||
int ray = SHAPETEST::START_EXPENSIVE_SYNCHRONOUS_SHAPE_TEST_LOS_PROBE(camCoords.x,
|
||||
auto shape_test = SHAPETEST::START_EXPENSIVE_SYNCHRONOUS_SHAPE_TEST_LOS_PROBE(camCoords.x,
|
||||
camCoords.y,
|
||||
camCoords.z,
|
||||
farCoords.x,
|
||||
@ -125,9 +124,9 @@ namespace big::entity
|
||||
-1,
|
||||
0,
|
||||
7);
|
||||
SHAPETEST::GET_SHAPE_TEST_RESULT(ray, &hit, &endCoords, &surfaceNormal, ent);
|
||||
auto test_result = SHAPETEST::GET_SHAPE_TEST_RESULT(shape_test, &hit, &dontCare, &dontCare, ent);
|
||||
|
||||
return (bool)hit;
|
||||
return (test_result == 2 && hit == TRUE);
|
||||
}
|
||||
|
||||
bool raycast(Vector3* endcoor)
|
||||
|
@ -189,7 +189,7 @@ namespace big
|
||||
ImGui::SameLine();
|
||||
components::command_checkbox<"aimbot">();
|
||||
|
||||
if (g.weapons.aimbot.enable)
|
||||
if (g.weapons.aimbot.enable || g.weapons.triggerbot)
|
||||
{
|
||||
components::command_checkbox<"aimonlyatplayer">();
|
||||
ImGui::SameLine();
|
||||
|
Loading…
Reference in New Issue
Block a user