Fix drawing self on ESP (#437)
This commit is contained in:
parent
db874462c5
commit
567ed50c3b
@ -7,10 +7,6 @@
|
|||||||
|
|
||||||
namespace big
|
namespace big
|
||||||
{
|
{
|
||||||
|
|
||||||
void esp::draw() {
|
|
||||||
if (!g->esp.enabled) return;
|
|
||||||
|
|
||||||
static ImColor death_bg = ImColor(0.117f, 0.113f, 0.172f, .75f);
|
static ImColor death_bg = ImColor(0.117f, 0.113f, 0.172f, .75f);
|
||||||
static ImColor armor_blue_bg = ImColor(0.36f, 0.71f, 0.89f, .75f);
|
static ImColor armor_blue_bg = ImColor(0.36f, 0.71f, 0.89f, .75f);
|
||||||
static ImColor armor_blue = ImColor(0.36f, 0.71f, 0.89f, 1.f);
|
static ImColor armor_blue = ImColor(0.36f, 0.71f, 0.89f, 1.f);
|
||||||
@ -21,14 +17,11 @@ namespace big
|
|||||||
static ImColor health_red_bg = ImColor(0.69f, 0.29f, 0.29f, .75f);
|
static ImColor health_red_bg = ImColor(0.69f, 0.29f, 0.29f, .75f);
|
||||||
static ImColor health_red = ImColor(0.69f, 0.29f, 0.29f, 1.f);
|
static ImColor health_red = ImColor(0.69f, 0.29f, 0.29f, 1.f);
|
||||||
|
|
||||||
if (const auto draw_list = ImGui::GetBackgroundDrawList(); draw_list)
|
void esp::draw_player(const player_ptr& plyr, ImDrawList* const draw_list) {
|
||||||
{
|
if (g->esp.hide_self && plyr->is_valid() && plyr->id() == gta_util::get_network_player_mgr()->m_local_net_player->m_player_id ||
|
||||||
for (const auto& [_, plyr] : g_player_service->players())
|
|
||||||
{
|
|
||||||
if (g->esp.hide_self && plyr->id() == gta_util::get_network_player_mgr()->m_local_net_player->m_player_id ||
|
|
||||||
!plyr->is_valid() ||
|
!plyr->is_valid() ||
|
||||||
!plyr->get_ped() ||
|
!plyr->get_ped() ||
|
||||||
!plyr->get_ped()->m_navigation) continue;
|
!plyr->get_ped()->m_navigation) return;
|
||||||
|
|
||||||
auto& player_pos = plyr->get_ped()->m_navigation->m_position;
|
auto& player_pos = plyr->get_ped()->m_navigation->m_position;
|
||||||
|
|
||||||
@ -37,7 +30,7 @@ namespace big
|
|||||||
const float distance = math::calculate_distance_from_game_cam(player_pos);
|
const float distance = math::calculate_distance_from_game_cam(player_pos);
|
||||||
const float multplr = distance > g->esp.global_render_distance[1] ? -1.f : 6.17757f / distance;
|
const float multplr = distance > g->esp.global_render_distance[1] ? -1.f : 6.17757f / distance;
|
||||||
|
|
||||||
if (multplr == -1.f || g->esp.global_render_distance[0] > distance) continue;
|
if (multplr == -1.f || g->esp.global_render_distance[0] > distance) return;
|
||||||
|
|
||||||
uint32_t ped_damage_bits = plyr->get_ped()->m_damage_bits;
|
uint32_t ped_damage_bits = plyr->get_ped()->m_damage_bits;
|
||||||
|
|
||||||
@ -135,6 +128,18 @@ namespace big
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void esp::draw() {
|
||||||
|
if (!g->esp.enabled) return;
|
||||||
|
|
||||||
|
if (const auto draw_list = ImGui::GetBackgroundDrawList(); draw_list)
|
||||||
|
{
|
||||||
|
draw_player(g_player_service->get_self(), draw_list);
|
||||||
|
|
||||||
|
for (const auto& [_, plyr] : g_player_service->players())
|
||||||
|
{
|
||||||
|
draw_player(plyr, draw_list);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,4 +1,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
#include "services/players/player_service.hpp"
|
||||||
|
|
||||||
namespace big
|
namespace big
|
||||||
{
|
{
|
||||||
@ -6,5 +7,6 @@ namespace big
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static void draw();
|
static void draw();
|
||||||
|
static void draw_player(const player_ptr& plyr, ImDrawList* const draw_list);
|
||||||
};
|
};
|
||||||
}
|
}
|
Reference in New Issue
Block a user