mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-01-04 00:23:27 +08:00
Fixed Player ESP potentially crashing on invalid models. (#2431)
* Check for and handle non-normal player models when doing ESP to prevent crashes. * Added sanity checks to the non-MP model scenario.
This commit is contained in:
parent
99af31cfa0
commit
0b0bde5958
@ -198,5 +198,5 @@ namespace big::functions
|
||||
|
||||
using remove_player_from_sender_list = bool(*)(void* list, uint64_t* rockstar_id);
|
||||
|
||||
using get_ped_pone = bool(*)(CPed* ped_ptr, rage::fvector4& output, PedBones bone);
|
||||
using get_ped_bone = bool(*)(CPed* ped_ptr, rage::fvector4& output, PedBones bone);
|
||||
}
|
||||
|
@ -359,7 +359,7 @@ namespace big
|
||||
|
||||
PVOID m_game_skeleton_update;
|
||||
|
||||
functions::get_ped_pone m_get_ped_pone;
|
||||
functions::get_ped_bone m_get_ped_bone;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
static_assert(sizeof(gta_pointers) % 8 == 0, "Pointers are not properly aligned");
|
||||
|
@ -1764,7 +1764,7 @@ namespace big
|
||||
"48 89 5C 24 ?? 48 89 6C 24 ?? 48 89 74 24 ?? 57 48 83 EC 60 48 8B 01 41 8B E8 48 8B F2",
|
||||
[](memory::handle ptr)
|
||||
{
|
||||
g_pointers->m_gta.m_get_ped_pone = ptr.as<functions::get_ped_pone>();
|
||||
g_pointers->m_gta.m_get_ped_bone = ptr.as<functions::get_ped_bone>();
|
||||
}
|
||||
}
|
||||
>(); // don't leave a trailing comma at the end
|
||||
|
@ -25,8 +25,22 @@ namespace big
|
||||
return;
|
||||
|
||||
rage::fvector4 player_pos;
|
||||
if (!g_pointers->m_gta.m_get_ped_pone(plyr->get_ped(), player_pos, PedBones::SKEL_Pelvis))
|
||||
return;
|
||||
|
||||
if (plyr->get_ped()->m_model_info->m_hash == RAGE_JOAAT("mp_m_freemode_01") || plyr->get_ped()->m_model_info->m_hash == RAGE_JOAAT("mp_f_freemode_01"))
|
||||
{
|
||||
if (!g_pointers->m_gta.m_get_ped_bone(plyr->get_ped(), player_pos, PedBones::SKEL_Pelvis))
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (plyr->get_ped()->GetNavigation() == nullptr)
|
||||
return;
|
||||
|
||||
if (auto navigation_pos = plyr->get_ped()->GetNavigation()->get_position())
|
||||
player_pos = {navigation_pos->x, navigation_pos->y, navigation_pos->z, 0};
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
float screen_x, screen_y;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user