diff --git a/src/game/features/vehicle/LowerVehicleStance.cpp b/src/game/features/vehicle/LowerVehicleStance.cpp new file mode 100644 index 0000000..debf32c --- /dev/null +++ b/src/game/features/vehicle/LowerVehicleStance.cpp @@ -0,0 +1,30 @@ +#include "core/commands/LoopedCommand.hpp" +#include "game/backend/Self.hpp" + +namespace YimMenu::Features +{ + class LowerVehicleStance : public LoopedCommand + { + using LoopedCommand::LoopedCommand; + + virtual void OnTick() override + { + auto veh = Self::GetVehicle(); + if (veh) + { + veh.LowerStance(true); + } + } + + virtual void OnDisable() override + { + auto veh = Self::GetVehicle(); + if (veh) + { + veh.LowerStance(false); + } + } + }; + + static LowerVehicleStance _LowerVehicleStance{"lowervehiclestance", "Lower Vehicle Stance", "Lowers your current vehicle's stance. Only some vehicles are supported"}; +} \ No newline at end of file diff --git a/src/game/frontend/submenus/Vehicle.cpp b/src/game/frontend/submenus/Vehicle.cpp index fec7041..bf4e6d7 100644 --- a/src/game/frontend/submenus/Vehicle.cpp +++ b/src/game/frontend/submenus/Vehicle.cpp @@ -29,6 +29,7 @@ namespace YimMenu::Submenus misc->AddItem(std::make_shared("speedometer"_J)); misc->AddItem(std::make_shared("seatbelt"_J)); + misc->AddItem(std::make_shared("lowervehiclestance"_J, "Lower Stance")); misc->AddItem(std::make_shared("allowhatsinvehicles"_J)); misc->AddItem(std::make_shared("lsccustomsbypass"_J)); misc->AddItem(std::make_shared("dlcvehicles"_J)); diff --git a/src/game/gta/Vehicle.cpp b/src/game/gta/Vehicle.cpp index d113bc8..3813bc9 100644 --- a/src/game/gta/Vehicle.cpp +++ b/src/game/gta/Vehicle.cpp @@ -141,12 +141,21 @@ namespace YimMenu void Vehicle::SetBoostCharge(int percentage) { ENTITY_ASSERT_VALID(); + ENTITY_ASSERT_CONTROL(); + if (!SupportsBoost()) return; VEHICLE::SET_ROCKET_BOOST_FILL(GetHandle(), percentage); } + void Vehicle::LowerStance(bool lower) + { + ENTITY_ASSERT_VALID(); + + VEHICLE::SET_REDUCED_SUSPENSION_FORCE(GetHandle(), lower); + } + std::string Vehicle::GetFullName() { auto model = ENTITY::GET_ENTITY_MODEL(GetHandle()); diff --git a/src/game/gta/Vehicle.hpp b/src/game/gta/Vehicle.hpp index f15cb0e..b962480 100644 --- a/src/game/gta/Vehicle.hpp +++ b/src/game/gta/Vehicle.hpp @@ -32,6 +32,9 @@ namespace YimMenu bool IsBoostActive(); void SetBoostCharge(int percentage = 100); + // stance + void LowerStance(bool lower); + std::string GetFullName(); }; } \ No newline at end of file