mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2024-12-22 20:17:24 +08:00
Prevent vehicle looped functions from running on vehicles we are not currently driving. (#3548)
This commit is contained in:
parent
20da24e626
commit
b18ac64905
@ -1,5 +1,6 @@
|
|||||||
#include "backend/looped_command.hpp"
|
#include "backend/looped_command.hpp"
|
||||||
#include "natives.hpp"
|
#include "natives.hpp"
|
||||||
|
#include "gta/vehicle_values.hpp"
|
||||||
|
|
||||||
namespace big
|
namespace big
|
||||||
{
|
{
|
||||||
@ -9,7 +10,7 @@ namespace big
|
|||||||
|
|
||||||
virtual void on_tick() override
|
virtual void on_tick() override
|
||||||
{
|
{
|
||||||
if (ENTITY::DOES_ENTITY_EXIST(self::veh))
|
if (self::veh != 0 && VEHICLE::GET_PED_IN_VEHICLE_SEAT(self::veh, SEAT_DRIVER, FALSE) == self::ped)
|
||||||
{
|
{
|
||||||
VEHICLE::SET_VEHICLE_DIRT_LEVEL(self::veh, 0.0f);
|
VEHICLE::SET_VEHICLE_DIRT_LEVEL(self::veh, 0.0f);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "backend/looped_command.hpp"
|
#include "backend/looped_command.hpp"
|
||||||
#include "natives.hpp"
|
#include "natives.hpp"
|
||||||
#include "util/vehicle.hpp"
|
#include "util/vehicle.hpp"
|
||||||
|
#include "gta/vehicle_values.hpp"
|
||||||
|
|
||||||
namespace big
|
namespace big
|
||||||
{
|
{
|
||||||
@ -10,8 +11,14 @@ namespace big
|
|||||||
|
|
||||||
virtual void on_tick() override
|
virtual void on_tick() override
|
||||||
{
|
{
|
||||||
const auto veh = self::veh;
|
Vehicle veh = self::veh;
|
||||||
if (!ENTITY::IS_ENTITY_A_VEHICLE(veh) || !entity::take_control_of(veh, 0))
|
|
||||||
|
if (veh == 0 || VEHICLE::GET_PED_IN_VEHICLE_SEAT(self::veh, SEAT_DRIVER, FALSE) != self::ped)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!entity::take_control_of(veh, 0))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -30,7 +37,7 @@ namespace big
|
|||||||
VEHICLE::FIX_VEHICLE_WINDOW(veh, rear_window_index);
|
VEHICLE::FIX_VEHICLE_WINDOW(veh, rear_window_index);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pointers->m_gta.m_decal_manager_remove(g_pointers->m_gta.m_decal_manager, g_pointers->m_gta.m_handle_to_ptr(veh), -1, 0, 0x00'01'E0'00);
|
g_pointers->m_gta.m_decal_manager_remove(g_pointers->m_gta.m_decal_manager, g_pointers->m_gta.m_handle_to_ptr(veh), -1, 0, 0x0001E000);
|
||||||
|
|
||||||
if (!g.vehicle.god_mode)
|
if (!g.vehicle.god_mode)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user