mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-01-03 16:13:36 +08:00
Added g_local_player pointer sanity checks. (#2792)
This commit is contained in:
parent
a29cca838c
commit
46d7d9f3ad
@ -7,6 +7,9 @@ namespace big
|
|||||||
{
|
{
|
||||||
void looped::vehicle_boost_behavior()
|
void looped::vehicle_boost_behavior()
|
||||||
{
|
{
|
||||||
|
if (g_local_player == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
auto* const vehicle = g_local_player->m_vehicle;
|
auto* const vehicle = g_local_player->m_vehicle;
|
||||||
|
|
||||||
bool is_rocket = VEHICLE::GET_HAS_ROCKET_BOOST(self::veh);
|
bool is_rocket = VEHICLE::GET_HAS_ROCKET_BOOST(self::veh);
|
||||||
|
@ -15,7 +15,7 @@ namespace big
|
|||||||
|
|
||||||
virtual void on_tick() override
|
virtual void on_tick() override
|
||||||
{
|
{
|
||||||
if (!self::veh || !g_local_player->m_vehicle || HUD::IS_PAUSE_MENU_ACTIVE() || HUD::IS_WARNING_MESSAGE_ACTIVE() || CAM::IS_SCREEN_FADED_OUT() || CAM::IS_SCREEN_FADING_OUT() || CAM::IS_SCREEN_FADING_IN())
|
if (!self::veh || !g_local_player || !g_local_player->m_vehicle || HUD::IS_PAUSE_MENU_ACTIVE() || HUD::IS_WARNING_MESSAGE_ACTIVE() || CAM::IS_SCREEN_FADED_OUT() || CAM::IS_SCREEN_FADING_OUT() || CAM::IS_SCREEN_FADING_IN())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -108,11 +108,14 @@ namespace big
|
|||||||
|
|
||||||
virtual void on_enable() override
|
virtual void on_enable() override
|
||||||
{
|
{
|
||||||
reset(g_local_player->m_vehicle);
|
if (g_local_player)
|
||||||
|
reset(g_local_player->m_vehicle);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void on_tick() override
|
virtual void on_tick() override
|
||||||
{
|
{
|
||||||
|
if (g_local_player == nullptr)
|
||||||
|
return;
|
||||||
const auto curr_veh = g_local_player->m_vehicle;
|
const auto curr_veh = g_local_player->m_vehicle;
|
||||||
if (curr_veh && !(g_local_player->m_ped_task_flag & (int)ePedTask::TASK_DRIVING))
|
if (curr_veh && !(g_local_player->m_ped_task_flag & (int)ePedTask::TASK_DRIVING))
|
||||||
{
|
{
|
||||||
|
@ -18,11 +18,14 @@ namespace big
|
|||||||
ImGui::SliderFloat("VIEW_BLACKHOLE_SCALE"_T.data(), &g.world.blackhole.scale, 2.f, 12.f, "%.0f");
|
ImGui::SliderFloat("VIEW_BLACKHOLE_SCALE"_T.data(), &g.world.blackhole.scale, 2.f, 12.f, "%.0f");
|
||||||
|
|
||||||
components::button("VIEW_BLACKHOLE_SET"_T, [] {
|
components::button("VIEW_BLACKHOLE_SET"_T, [] {
|
||||||
const auto player_pos = g_local_player->get_position();
|
if (g_local_player)
|
||||||
|
{
|
||||||
|
const auto player_pos = g_local_player->get_position();
|
||||||
|
|
||||||
g.world.blackhole.pos.x = player_pos->x;
|
g.world.blackhole.pos.x = player_pos->x;
|
||||||
g.world.blackhole.pos.y = player_pos->y;
|
g.world.blackhole.pos.y = player_pos->y;
|
||||||
g.world.blackhole.pos.z = player_pos->z;
|
g.world.blackhole.pos.z = player_pos->z;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ImGui::SeparatorText("VIEW_BLACKHOLE_CUSTOM"_T.data());
|
ImGui::SeparatorText("VIEW_BLACKHOLE_CUSTOM"_T.data());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user