mirror of
https://github.com/YimMenu/YimMenuV2.git
synced 2026-10-10 03:43:15 +08:00
feat: implement seatbelt (#31)
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
#include "core/commands/LoopedCommand.hpp"
|
||||
#include "game/gta/Natives.hpp"
|
||||
#include "game/backend/Self.hpp"
|
||||
|
||||
namespace YimMenu::Features
|
||||
{
|
||||
class Seatbelt : public LoopedCommand
|
||||
{
|
||||
using LoopedCommand::LoopedCommand;
|
||||
|
||||
static constexpr int VEHICLE_KNOCK_OFF_NEVER = 1;
|
||||
static constexpr int VEHICLE_KNOCK_OFF_DEFAULT = 0;
|
||||
|
||||
virtual void OnTick() override
|
||||
{
|
||||
auto handle = Self::GetPed().GetHandle();
|
||||
|
||||
PED::SET_PED_CONFIG_FLAG(handle, 32, false);
|
||||
PED::SET_PED_CAN_BE_KNOCKED_OFF_VEHICLE(handle, VEHICLE_KNOCK_OFF_NEVER);
|
||||
}
|
||||
|
||||
virtual void OnDisable() override
|
||||
{
|
||||
auto handle = Self::GetPed().GetHandle();
|
||||
|
||||
PED::SET_PED_CONFIG_FLAG(handle, 32, true);
|
||||
PED::SET_PED_CAN_BE_KNOCKED_OFF_VEHICLE(handle, VEHICLE_KNOCK_OFF_DEFAULT);
|
||||
}
|
||||
};
|
||||
|
||||
static Seatbelt _Seatbelt{"seatbelt", "Seatbelt", "Prevents you from falling out of vehicles."};
|
||||
};
|
||||
@@ -70,6 +70,7 @@ namespace YimMenu::Submenus
|
||||
vehicleGlobalsGroup->AddItem(std::make_shared<CommandItem>("repairvehicle"_J));
|
||||
|
||||
vehicleMiscGroup->AddItem(std::make_shared<BoolCommandItem>("speedometer"_J));
|
||||
vehicleMiscGroup->AddItem(std::make_shared<BoolCommandItem>("seatbelt"_J));
|
||||
|
||||
vehicle->AddItem(vehicleGlobalsGroup);
|
||||
vehicle->AddItem(vehicleMiscGroup);
|
||||
|
||||
Reference in New Issue
Block a user