From 861ebdb2aed8a43e4e01b7c8805cfadbd366142c Mon Sep 17 00:00:00 2001 From: DayibBaba <79384354+DayibBaba@users.noreply.github.com> Date: Fri, 30 Jun 2023 13:38:44 +0200 Subject: [PATCH] More bug fixes (#1557) Fixed nearby features affecting players and local ped. Removed faulty vehicle kick protection from can_apply Fixes #1540 --- src/backend/looped/world/nearby/peds_rain.cpp | 2 +- src/backend/looped/world/nearby/vehicles_rain.cpp | 2 +- src/util/entity.hpp | 3 +++ src/views/world/view_world.cpp | 3 ++- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/backend/looped/world/nearby/peds_rain.cpp b/src/backend/looped/world/nearby/peds_rain.cpp index 3a70bdd0..c3042744 100644 --- a/src/backend/looped/world/nearby/peds_rain.cpp +++ b/src/backend/looped/world/nearby/peds_rain.cpp @@ -13,7 +13,7 @@ namespace big { for (auto ped : entity::get_entities(false, true)) { - if (!ENTITY::IS_ENTITY_IN_AIR(ped) && entity::take_control_of(ped, 0)) + if (!ENTITY::IS_ENTITY_IN_AIR(ped) && entity::take_control_of(ped, 0) && !PED::IS_PED_A_PLAYER(ped) && ped != self::ped) { Vector3 my_location = ENTITY::GET_ENTITY_COORDS(self::ped, 1); my_location.x = my_location.x + (rand() % 100 + (-50)); diff --git a/src/backend/looped/world/nearby/vehicles_rain.cpp b/src/backend/looped/world/nearby/vehicles_rain.cpp index e82e0194..370fb434 100644 --- a/src/backend/looped/world/nearby/vehicles_rain.cpp +++ b/src/backend/looped/world/nearby/vehicles_rain.cpp @@ -14,7 +14,7 @@ namespace big { for (auto vehicles : entity::get_entities(true, false)) { - if (!ENTITY::IS_ENTITY_IN_AIR(vehicles)) + if (!ENTITY::IS_ENTITY_IN_AIR(vehicles) && vehicles != self::veh) { if (entity::take_control_of(vehicles, 0)) { diff --git a/src/util/entity.hpp b/src/util/entity.hpp index a2ac00e7..59924499 100644 --- a/src/util/entity.hpp +++ b/src/util/entity.hpp @@ -121,6 +121,9 @@ namespace big::entity { for (auto ped : pools::get_all_peds()) { + if(ped == g_local_player) + continue; + target_entities.push_back(g_pointers->m_gta.m_ptr_to_handle(ped)); } } diff --git a/src/views/world/view_world.cpp b/src/views/world/view_world.cpp index bdcf9620..4934d614 100644 --- a/src/views/world/view_world.cpp +++ b/src/views/world/view_world.cpp @@ -28,7 +28,8 @@ namespace big components::button("Kill Enemies", [] { for (auto peds : entity::get_entities(false, true)) { - ped::kill_ped_by_relation(peds, 4 || 5); + if (!PED::IS_PED_A_PLAYER(peds)) + ped::kill_ped_by_relation(peds, 4 || 5); } });