2021-05-19 14:35:05 +02:00
|
|
|
#pragma once
|
2021-05-19 15:31:02 +02:00
|
|
|
#include "gta/joaat.hpp"
|
2023-03-01 21:27:15 +00:00
|
|
|
#include "gta_util.hpp"
|
|
|
|
#include "math.hpp"
|
2021-05-19 14:35:05 +02:00
|
|
|
#include "natives.hpp"
|
2023-04-16 18:28:49 +00:00
|
|
|
#include "pools.hpp"
|
2021-05-19 14:35:05 +02:00
|
|
|
#include "script.hpp"
|
2023-06-07 23:56:43 +02:00
|
|
|
#include "services/players/player_service.hpp"
|
2021-05-19 14:35:05 +02:00
|
|
|
|
|
|
|
namespace big::entity
|
|
|
|
{
|
2021-05-19 15:31:02 +02:00
|
|
|
inline void cage_ped(Ped ped)
|
|
|
|
{
|
|
|
|
Hash hash = RAGE_JOAAT("prop_gold_cont_01");
|
|
|
|
|
|
|
|
Vector3 location = ENTITY::GET_ENTITY_COORDS(ped, true);
|
|
|
|
OBJECT::CREATE_OBJECT(hash, location.x, location.y, location.z - 1.f, true, false, false);
|
|
|
|
}
|
|
|
|
|
2022-03-02 08:48:53 -05:00
|
|
|
inline void clean_ped(Ped ped)
|
|
|
|
{
|
2022-05-23 06:38:45 +08:00
|
|
|
Ped player_ped = self::ped;
|
|
|
|
|
|
|
|
PED::CLEAR_PED_BLOOD_DAMAGE(player_ped);
|
|
|
|
PED::CLEAR_PED_WETNESS(player_ped);
|
|
|
|
PED::CLEAR_PED_ENV_DIRT(player_ped);
|
|
|
|
PED::RESET_PED_VISIBLE_DAMAGE(player_ped);
|
2022-03-02 08:48:53 -05:00
|
|
|
}
|
|
|
|
|
2023-08-07 04:16:08 -04:00
|
|
|
bool take_control_of(Entity ent, int timeout = 300);
|
2021-05-20 18:57:53 +02:00
|
|
|
inline void delete_entity(Entity ent)
|
|
|
|
{
|
2023-06-21 10:01:00 +02:00
|
|
|
if (!ENTITY::DOES_ENTITY_EXIST(ent))
|
|
|
|
return;
|
2023-08-07 04:16:08 -04:00
|
|
|
if (!take_control_of(ent))
|
|
|
|
{
|
|
|
|
LOG(VERBOSE) << "Failed to take control of entity before deleting";
|
|
|
|
return;
|
|
|
|
}
|
2023-06-21 10:01:00 +02:00
|
|
|
|
2021-05-20 18:57:53 +02:00
|
|
|
ENTITY::DETACH_ENTITY(ent, 1, 1);
|
2023-08-07 04:16:08 -04:00
|
|
|
ENTITY::SET_ENTITY_COORDS_NO_OFFSET(ent, 7000.f, 7000.f, 15.f, 0, 0, 0);
|
|
|
|
if (!ENTITY::IS_ENTITY_A_MISSION_ENTITY(ent))
|
|
|
|
{
|
|
|
|
ENTITY::SET_ENTITY_AS_MISSION_ENTITY(ent, true, true);
|
|
|
|
}
|
2021-05-20 18:57:53 +02:00
|
|
|
ENTITY::DELETE_ENTITY(&ent);
|
|
|
|
}
|
|
|
|
|
2021-05-19 15:31:02 +02:00
|
|
|
inline bool raycast(Entity* ent)
|
|
|
|
{
|
|
|
|
BOOL hit;
|
|
|
|
Vector3 endCoords;
|
|
|
|
Vector3 surfaceNormal;
|
|
|
|
|
|
|
|
Vector3 camCoords = CAM::GET_GAMEPLAY_CAM_COORD();
|
2023-03-01 21:27:15 +00:00
|
|
|
Vector3 rot = CAM::GET_GAMEPLAY_CAM_ROT(2);
|
|
|
|
Vector3 dir = math::rotation_to_direction(rot);
|
2021-05-19 15:31:02 +02:00
|
|
|
Vector3 farCoords;
|
|
|
|
|
|
|
|
farCoords.x = camCoords.x + dir.x * 1000;
|
|
|
|
farCoords.y = camCoords.y + dir.y * 1000;
|
|
|
|
farCoords.z = camCoords.z + dir.z * 1000;
|
|
|
|
|
2023-03-01 21:27:15 +00:00
|
|
|
int ray = SHAPETEST::START_EXPENSIVE_SYNCHRONOUS_SHAPE_TEST_LOS_PROBE(camCoords.x,
|
|
|
|
camCoords.y,
|
|
|
|
camCoords.z,
|
|
|
|
farCoords.x,
|
|
|
|
farCoords.y,
|
|
|
|
farCoords.z,
|
|
|
|
-1,
|
|
|
|
0,
|
|
|
|
7);
|
2021-05-19 15:31:02 +02:00
|
|
|
SHAPETEST::GET_SHAPE_TEST_RESULT(ray, &hit, &endCoords, &surfaceNormal, ent);
|
|
|
|
|
|
|
|
return (bool)hit;
|
|
|
|
}
|
|
|
|
|
2023-07-14 17:31:03 -04:00
|
|
|
inline bool raycast(Vector3* endcoor)
|
|
|
|
{
|
|
|
|
Entity ent;
|
|
|
|
BOOL hit;
|
|
|
|
Vector3 surfaceNormal;
|
|
|
|
|
|
|
|
Vector3 camCoords = CAM::GET_GAMEPLAY_CAM_COORD();
|
|
|
|
Vector3 dir = math::rotation_to_direction(CAM::GET_GAMEPLAY_CAM_ROT(2));
|
|
|
|
Vector3 farCoords;
|
|
|
|
|
|
|
|
farCoords.x = camCoords.x + dir.x * 1000;
|
|
|
|
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,
|
|
|
|
camCoords.y,
|
|
|
|
camCoords.z,
|
|
|
|
farCoords.x,
|
|
|
|
farCoords.y,
|
|
|
|
farCoords.z,
|
|
|
|
-1,
|
|
|
|
0,
|
|
|
|
7);
|
|
|
|
SHAPETEST::GET_SHAPE_TEST_RESULT(ray, &hit, endcoor, &surfaceNormal, &ent);
|
|
|
|
|
|
|
|
return (bool)hit;
|
|
|
|
}
|
|
|
|
|
2023-02-09 05:46:08 +08:00
|
|
|
inline bool network_has_control_of_entity(rage::netObject* net_object)
|
2021-05-19 14:35:05 +02:00
|
|
|
{
|
2023-02-11 05:33:47 +08:00
|
|
|
return !net_object || !net_object->m_next_owner_id && (net_object->m_control_id == -1);
|
2023-02-09 05:46:08 +08:00
|
|
|
}
|
2022-11-21 15:42:12 +00:00
|
|
|
|
2023-08-07 04:16:08 -04:00
|
|
|
inline bool take_control_of(Entity ent, int timeout)
|
2023-02-09 05:46:08 +08:00
|
|
|
{
|
2023-04-15 22:34:39 +02:00
|
|
|
if (!*g_pointers->m_gta.m_is_session_started)
|
|
|
|
return true;
|
|
|
|
|
2023-04-14 18:54:07 +02:00
|
|
|
auto hnd = g_pointers->m_gta.m_handle_to_ptr(ent);
|
2023-04-12 20:10:56 +02:00
|
|
|
|
2023-04-14 18:54:07 +02:00
|
|
|
if (!hnd || !hnd->m_net_object || !*g_pointers->m_gta.m_is_session_started)
|
2023-03-10 22:41:46 +00:00
|
|
|
return false;
|
2023-04-12 20:10:56 +02:00
|
|
|
|
|
|
|
if (network_has_control_of_entity(hnd->m_net_object))
|
|
|
|
return true;
|
2023-03-10 22:41:46 +00:00
|
|
|
|
|
|
|
for (int i = 0; i < timeout; i++)
|
|
|
|
{
|
2023-04-14 18:54:07 +02:00
|
|
|
g_pointers->m_gta.m_request_control(hnd->m_net_object);
|
2023-03-10 22:41:46 +00:00
|
|
|
|
2023-04-12 20:10:56 +02:00
|
|
|
if (network_has_control_of_entity(hnd->m_net_object))
|
|
|
|
return true;
|
2023-03-10 22:41:46 +00:00
|
|
|
|
|
|
|
if (timeout != 0)
|
|
|
|
script::get_current()->yield();
|
2023-03-01 21:27:15 +00:00
|
|
|
}
|
2023-03-10 22:41:46 +00:00
|
|
|
|
2023-04-12 20:10:56 +02:00
|
|
|
return false;
|
2021-05-19 14:35:05 +02:00
|
|
|
}
|
Feature Additions, GUI Tweaks, Fixes (#975)
* Added view nearby to view header, moved get_entities function to entities and refactored some code. Also implemented a sphere scale to the blackhole as it can get big
* added delete and kill nearby peds and updated ped header
* added some nearby ped looped commands, and some changes to extend the buttons
* add vehicle options to nearby
* add most ciritcal feature kill enemies
* changes to ignore peds based off of some of maybegreat's suggestions, same with ped_rain, removed loose comment. Updated vehicle.hpp, changed size of vehicle buttons and inlined kill enemies
* fixed a problem where the vehicle options crashed + added color
* updated colors and added on disable for ped_rush
* finished and added vehicle rain feature
* added aimbot and triggerbot, added templating to buttons
* update vehicle rain desc
* added vdistance check, player check, police check, enemy check. Added even more commenting... sue me. 3 toggles added for the checks and slider for dist. Will tweak more later
* switched to goto statements instead of continue, should be done now
* removed delete nearby vehicles
* there was no check in get_entities for our local vehicle
2023-02-25 13:33:16 -07:00
|
|
|
|
2023-06-21 10:01:00 +02:00
|
|
|
inline std::vector<Entity> get_entities(bool vehicles, bool peds, bool props = false, bool include_self_veh = false)
|
Feature Additions, GUI Tweaks, Fixes (#975)
* Added view nearby to view header, moved get_entities function to entities and refactored some code. Also implemented a sphere scale to the blackhole as it can get big
* added delete and kill nearby peds and updated ped header
* added some nearby ped looped commands, and some changes to extend the buttons
* add vehicle options to nearby
* add most ciritcal feature kill enemies
* changes to ignore peds based off of some of maybegreat's suggestions, same with ped_rain, removed loose comment. Updated vehicle.hpp, changed size of vehicle buttons and inlined kill enemies
* fixed a problem where the vehicle options crashed + added color
* updated colors and added on disable for ped_rush
* finished and added vehicle rain feature
* added aimbot and triggerbot, added templating to buttons
* update vehicle rain desc
* added vdistance check, player check, police check, enemy check. Added even more commenting... sue me. 3 toggles added for the checks and slider for dist. Will tweak more later
* switched to goto statements instead of continue, should be done now
* removed delete nearby vehicles
* there was no check in get_entities for our local vehicle
2023-02-25 13:33:16 -07:00
|
|
|
{
|
|
|
|
std::vector<Entity> target_entities;
|
|
|
|
|
|
|
|
if (vehicles)
|
|
|
|
{
|
2023-04-16 18:28:49 +00:00
|
|
|
for (auto vehicle : pools::get_all_vehicles())
|
Feature Additions, GUI Tweaks, Fixes (#975)
* Added view nearby to view header, moved get_entities function to entities and refactored some code. Also implemented a sphere scale to the blackhole as it can get big
* added delete and kill nearby peds and updated ped header
* added some nearby ped looped commands, and some changes to extend the buttons
* add vehicle options to nearby
* add most ciritcal feature kill enemies
* changes to ignore peds based off of some of maybegreat's suggestions, same with ped_rain, removed loose comment. Updated vehicle.hpp, changed size of vehicle buttons and inlined kill enemies
* fixed a problem where the vehicle options crashed + added color
* updated colors and added on disable for ped_rush
* finished and added vehicle rain feature
* added aimbot and triggerbot, added templating to buttons
* update vehicle rain desc
* added vdistance check, player check, police check, enemy check. Added even more commenting... sue me. 3 toggles added for the checks and slider for dist. Will tweak more later
* switched to goto statements instead of continue, should be done now
* removed delete nearby vehicles
* there was no check in get_entities for our local vehicle
2023-02-25 13:33:16 -07:00
|
|
|
{
|
2023-06-21 10:01:00 +02:00
|
|
|
if (!include_self_veh && vehicle == gta_util::get_local_vehicle())
|
Feature Additions, GUI Tweaks, Fixes (#975)
* Added view nearby to view header, moved get_entities function to entities and refactored some code. Also implemented a sphere scale to the blackhole as it can get big
* added delete and kill nearby peds and updated ped header
* added some nearby ped looped commands, and some changes to extend the buttons
* add vehicle options to nearby
* add most ciritcal feature kill enemies
* changes to ignore peds based off of some of maybegreat's suggestions, same with ped_rain, removed loose comment. Updated vehicle.hpp, changed size of vehicle buttons and inlined kill enemies
* fixed a problem where the vehicle options crashed + added color
* updated colors and added on disable for ped_rush
* finished and added vehicle rain feature
* added aimbot and triggerbot, added templating to buttons
* update vehicle rain desc
* added vdistance check, player check, police check, enemy check. Added even more commenting... sue me. 3 toggles added for the checks and slider for dist. Will tweak more later
* switched to goto statements instead of continue, should be done now
* removed delete nearby vehicles
* there was no check in get_entities for our local vehicle
2023-02-25 13:33:16 -07:00
|
|
|
continue;
|
|
|
|
|
2023-04-16 18:28:49 +00:00
|
|
|
target_entities.push_back(g_pointers->m_gta.m_ptr_to_handle(vehicle));
|
Feature Additions, GUI Tweaks, Fixes (#975)
* Added view nearby to view header, moved get_entities function to entities and refactored some code. Also implemented a sphere scale to the blackhole as it can get big
* added delete and kill nearby peds and updated ped header
* added some nearby ped looped commands, and some changes to extend the buttons
* add vehicle options to nearby
* add most ciritcal feature kill enemies
* changes to ignore peds based off of some of maybegreat's suggestions, same with ped_rain, removed loose comment. Updated vehicle.hpp, changed size of vehicle buttons and inlined kill enemies
* fixed a problem where the vehicle options crashed + added color
* updated colors and added on disable for ped_rush
* finished and added vehicle rain feature
* added aimbot and triggerbot, added templating to buttons
* update vehicle rain desc
* added vdistance check, player check, police check, enemy check. Added even more commenting... sue me. 3 toggles added for the checks and slider for dist. Will tweak more later
* switched to goto statements instead of continue, should be done now
* removed delete nearby vehicles
* there was no check in get_entities for our local vehicle
2023-02-25 13:33:16 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (peds)
|
|
|
|
{
|
2023-04-16 18:28:49 +00:00
|
|
|
for (auto ped : pools::get_all_peds())
|
Feature Additions, GUI Tweaks, Fixes (#975)
* Added view nearby to view header, moved get_entities function to entities and refactored some code. Also implemented a sphere scale to the blackhole as it can get big
* added delete and kill nearby peds and updated ped header
* added some nearby ped looped commands, and some changes to extend the buttons
* add vehicle options to nearby
* add most ciritcal feature kill enemies
* changes to ignore peds based off of some of maybegreat's suggestions, same with ped_rain, removed loose comment. Updated vehicle.hpp, changed size of vehicle buttons and inlined kill enemies
* fixed a problem where the vehicle options crashed + added color
* updated colors and added on disable for ped_rush
* finished and added vehicle rain feature
* added aimbot and triggerbot, added templating to buttons
* update vehicle rain desc
* added vdistance check, player check, police check, enemy check. Added even more commenting... sue me. 3 toggles added for the checks and slider for dist. Will tweak more later
* switched to goto statements instead of continue, should be done now
* removed delete nearby vehicles
* there was no check in get_entities for our local vehicle
2023-02-25 13:33:16 -07:00
|
|
|
{
|
2023-07-12 17:03:29 +00:00
|
|
|
if (ped == g_local_player)
|
2023-06-30 13:38:44 +02:00
|
|
|
continue;
|
|
|
|
|
2023-04-16 18:28:49 +00:00
|
|
|
target_entities.push_back(g_pointers->m_gta.m_ptr_to_handle(ped));
|
Feature Additions, GUI Tweaks, Fixes (#975)
* Added view nearby to view header, moved get_entities function to entities and refactored some code. Also implemented a sphere scale to the blackhole as it can get big
* added delete and kill nearby peds and updated ped header
* added some nearby ped looped commands, and some changes to extend the buttons
* add vehicle options to nearby
* add most ciritcal feature kill enemies
* changes to ignore peds based off of some of maybegreat's suggestions, same with ped_rain, removed loose comment. Updated vehicle.hpp, changed size of vehicle buttons and inlined kill enemies
* fixed a problem where the vehicle options crashed + added color
* updated colors and added on disable for ped_rush
* finished and added vehicle rain feature
* added aimbot and triggerbot, added templating to buttons
* update vehicle rain desc
* added vdistance check, player check, police check, enemy check. Added even more commenting... sue me. 3 toggles added for the checks and slider for dist. Will tweak more later
* switched to goto statements instead of continue, should be done now
* removed delete nearby vehicles
* there was no check in get_entities for our local vehicle
2023-02-25 13:33:16 -07:00
|
|
|
}
|
|
|
|
}
|
2023-06-21 10:01:00 +02:00
|
|
|
|
|
|
|
if (props)
|
|
|
|
{
|
|
|
|
for (auto prop : pools::get_all_props())
|
|
|
|
{
|
|
|
|
target_entities.push_back(g_pointers->m_gta.m_ptr_to_handle(prop));
|
|
|
|
}
|
|
|
|
}
|
Feature Additions, GUI Tweaks, Fixes (#975)
* Added view nearby to view header, moved get_entities function to entities and refactored some code. Also implemented a sphere scale to the blackhole as it can get big
* added delete and kill nearby peds and updated ped header
* added some nearby ped looped commands, and some changes to extend the buttons
* add vehicle options to nearby
* add most ciritcal feature kill enemies
* changes to ignore peds based off of some of maybegreat's suggestions, same with ped_rain, removed loose comment. Updated vehicle.hpp, changed size of vehicle buttons and inlined kill enemies
* fixed a problem where the vehicle options crashed + added color
* updated colors and added on disable for ped_rush
* finished and added vehicle rain feature
* added aimbot and triggerbot, added templating to buttons
* update vehicle rain desc
* added vdistance check, player check, police check, enemy check. Added even more commenting... sue me. 3 toggles added for the checks and slider for dist. Will tweak more later
* switched to goto statements instead of continue, should be done now
* removed delete nearby vehicles
* there was no check in get_entities for our local vehicle
2023-02-25 13:33:16 -07:00
|
|
|
return target_entities;
|
|
|
|
}
|
2023-03-09 12:23:01 +00:00
|
|
|
|
|
|
|
inline bool load_ground_at_3dcoord(Vector3& location)
|
|
|
|
{
|
|
|
|
float groundZ;
|
2023-08-19 11:01:08 +00:00
|
|
|
const uint8_t attempts = 100;
|
|
|
|
bool done = true;
|
2023-03-09 12:23:01 +00:00
|
|
|
|
|
|
|
for (uint8_t i = 0; i < attempts; i++)
|
|
|
|
{
|
2023-08-19 11:01:08 +00:00
|
|
|
STREAMING::REQUEST_COLLISION_AT_COORD(location.x, location.y, 0.0f);
|
2023-03-09 12:23:01 +00:00
|
|
|
|
|
|
|
if (MISC::GET_GROUND_Z_FOR_3D_COORD(location.x, location.y, 1000.f, &groundZ, false, false))
|
|
|
|
{
|
|
|
|
location.z = groundZ + 1.f;
|
2023-08-19 11:01:08 +00:00
|
|
|
done = true;
|
|
|
|
}
|
2023-03-09 12:23:01 +00:00
|
|
|
|
2023-08-19 11:01:08 +00:00
|
|
|
float height;
|
|
|
|
if (done && WATER::GET_WATER_HEIGHT(location.x, location.y, location.z, &height))
|
|
|
|
{
|
|
|
|
location.z = height + 1.f;
|
2023-03-09 12:23:01 +00:00
|
|
|
}
|
|
|
|
|
2023-08-19 11:01:08 +00:00
|
|
|
if (done)
|
|
|
|
return true;
|
|
|
|
|
2023-03-09 12:23:01 +00:00
|
|
|
script::get_current()->yield();
|
|
|
|
}
|
|
|
|
|
2023-08-19 11:01:08 +00:00
|
|
|
location.z = 200.0f;
|
2023-03-09 12:23:01 +00:00
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2023-03-30 00:37:10 +02:00
|
|
|
|
|
|
|
inline double distance_to_middle_of_screen(const rage::fvector2& screen_pos)
|
|
|
|
{
|
|
|
|
double cumulative_distance{};
|
|
|
|
|
|
|
|
if (screen_pos.x > 0.5)
|
|
|
|
cumulative_distance += screen_pos.x - 0.5;
|
|
|
|
else
|
|
|
|
cumulative_distance += 0.5 - screen_pos.x;
|
|
|
|
|
|
|
|
if (screen_pos.y > 0.5)
|
|
|
|
cumulative_distance += screen_pos.y - 0.5;
|
|
|
|
else
|
|
|
|
cumulative_distance += 0.5 - screen_pos.y;
|
|
|
|
|
|
|
|
return cumulative_distance;
|
|
|
|
}
|
|
|
|
|
2023-06-07 23:56:43 +02:00
|
|
|
inline Entity get_entity_closest_to_middle_of_screen(rage::fwEntity** pointer = nullptr, std::vector<Entity> ignore_entities = {}, bool include_veh = true, bool include_ped = true, bool include_prop = true, bool include_players = true)
|
2023-03-30 00:37:10 +02:00
|
|
|
{
|
|
|
|
Entity closest_entity{};
|
2023-06-07 23:56:43 +02:00
|
|
|
rage::fwEntity* closest_entity_ptr = nullptr;
|
|
|
|
float distance = 1;
|
2023-03-30 00:37:10 +02:00
|
|
|
|
2023-06-07 23:56:43 +02:00
|
|
|
auto ignored_entity = [=](Entity handle) -> bool {
|
|
|
|
if (handle == self::ped)
|
|
|
|
return true;
|
2023-03-30 00:37:10 +02:00
|
|
|
|
2023-06-07 23:56:43 +02:00
|
|
|
for (auto ent : ignore_entities)
|
2023-03-30 00:37:10 +02:00
|
|
|
{
|
2023-06-07 23:56:43 +02:00
|
|
|
if (handle == ent)
|
|
|
|
return true;
|
|
|
|
}
|
2023-03-30 00:37:10 +02:00
|
|
|
|
2023-06-07 23:56:43 +02:00
|
|
|
return false;
|
|
|
|
};
|
|
|
|
|
|
|
|
auto update_closest_entity = [&](Entity handle, rage::fwEntity* entity_ptr) {
|
|
|
|
Vector3 pos = ENTITY::GET_ENTITY_COORDS(handle, 1);
|
|
|
|
rage::fvector2 screenpos;
|
|
|
|
HUD::GET_HUD_SCREEN_POSITION_FROM_WORLD_POSITION(pos.x, pos.y, pos.z, &screenpos.x, &screenpos.y);
|
|
|
|
|
|
|
|
if (distance_to_middle_of_screen(screenpos) < distance && ENTITY::HAS_ENTITY_CLEAR_LOS_TO_ENTITY(self::ped, handle, 17) && !ignored_entity(handle))
|
|
|
|
{
|
|
|
|
closest_entity = handle;
|
|
|
|
closest_entity_ptr = entity_ptr;
|
|
|
|
distance = distance_to_middle_of_screen(screenpos);
|
2023-03-30 00:37:10 +02:00
|
|
|
}
|
2023-06-07 23:56:43 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
auto include_pool = [&](auto& pool) {
|
|
|
|
for (const auto ptr : pool())
|
|
|
|
if (ptr)
|
|
|
|
update_closest_entity(g_pointers->m_gta.m_ptr_to_handle(ptr), ptr);
|
|
|
|
};
|
|
|
|
|
|
|
|
if (include_veh)
|
|
|
|
include_pool(pools::get_all_vehicles);
|
2023-03-30 00:37:10 +02:00
|
|
|
|
2023-06-07 23:56:43 +02:00
|
|
|
if (include_ped)
|
|
|
|
include_pool(pools::get_all_peds);
|
|
|
|
|
|
|
|
if (include_prop)
|
|
|
|
include_pool(pools::get_all_props);
|
|
|
|
|
|
|
|
if (include_players)
|
2023-03-30 00:37:10 +02:00
|
|
|
{
|
2023-06-07 23:56:43 +02:00
|
|
|
for (auto player : g_player_service->players() | std::ranges::views::values)
|
2023-03-30 00:37:10 +02:00
|
|
|
{
|
2023-06-07 23:56:43 +02:00
|
|
|
if (player->get_ped())
|
2023-03-30 00:37:10 +02:00
|
|
|
{
|
2023-06-07 23:56:43 +02:00
|
|
|
Ped handle = g_pointers->m_gta.m_ptr_to_handle(player->get_ped());
|
|
|
|
update_closest_entity(handle, player->get_ped());
|
2023-03-30 00:37:10 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-06-14 21:29:25 +00:00
|
|
|
if (pointer)
|
|
|
|
*pointer = closest_entity_ptr;
|
2023-06-07 23:56:43 +02:00
|
|
|
|
2023-03-30 00:37:10 +02:00
|
|
|
return closest_entity;
|
|
|
|
}
|
2023-06-07 23:56:43 +02:00
|
|
|
}
|