feat(Self): enter last vehicle, infinite parachutes (#33)

* feat(Self): enter last vehicle, infinite parachutes

* fix: consistent style
This commit is contained in:
Daniel authored and GitHub committed 2025-03-26 23:54:46 +00:00
1 parent 1bfdf2d8f4
commit ebb0a26f7e
4 files changed
+70 -2

No files matched your search

@@ -0,0 +1,34 @@
#include "core/commands/LoopedCommand.hpp"
#include "game/backend/Self.hpp"
#include "game/gta/Natives.hpp"
namespace YimMenu::Features
{
class InfiniteParachutes : public LoopedCommand
{
using LoopedCommand::LoopedCommand;
virtual void OnTick() override
{
if (auto player = Self::GetPlayer())
{
PLAYER::SET_PLAYER_HAS_RESERVE_PARACHUTE(player.GetId());
}
if (auto ped = Self::GetPed())
{
if (!WEAPON::HAS_PED_GOT_WEAPON(ped.GetHandle(), "GADGET_PARACHUTE"_J, false))
{
WEAPON::GIVE_DELAYED_WEAPON_TO_PED(ped.GetHandle(), "GADGET_PARACHUTE"_J, 1, false);
}
}
}
virtual void OnDisable() override
{
}
};
static InfiniteParachutes _InfiniteParachutes{"infiniteparachutes", "Infinite Parachutes", "Always have a parachute."};
};
+32
View File
@@ -0,0 +1,32 @@
#include "core/commands/Command.hpp"
#include "game/gta/Vehicle.hpp"
#include "game/backend/Self.hpp"
#include "game/gta/Natives.hpp"
#include "game/gta/data/VehicleValues.hpp"
namespace YimMenu::Features
{
class EnterLastVehicle : Command
{
using Command::Command;
virtual void OnCall() override
{
auto vehicleHandle = PLAYER::GET_PLAYERS_LAST_VEHICLE();
if (vehicleHandle != 0 && vehicleHandle != Self::GetVehicle().GetHandle()) {
// TODO This logic should probably be moved into the Vehicle class
for (int seat = (int)SeatPositions::SEAT_DRIVER; seat < (int)SeatPositions::SEAT_BACKPASSENGER; seat++)
{
if (VEHICLE::IS_VEHICLE_SEAT_FREE(vehicleHandle, seat, true))
{
PED::SET_PED_INTO_VEHICLE(Self::GetPed().GetHandle(), vehicleHandle, seat);
break;
}
}
}
}
};
static EnterLastVehicle _EnterLastVehicle{"enterlastvehicle", "Enter last vehicle", "Enters the last vehicle you were in."};
};
+1 -1
View File
@@ -39,7 +39,7 @@ namespace YimMenu::Features
if (_SpawnInVehicle.GetState())
{
PED::SET_PED_INTO_VEHICLE(Self::GetPed().GetHandle(), vehHandle, -1);
PED::SET_PED_INTO_VEHICLE(Self::GetPed().GetHandle(), vehHandle, (int)SeatPositions::SEAT_DRIVER);
}
if (_SpawnWithMaximumUpgrades.GetState())
+3 -1
View File
@@ -55,6 +55,7 @@ namespace YimMenu::Submenus
weaponsGlobalsGroup->AddItem(std::make_shared<BoolCommandItem>("infiniteammo"_J));
weaponsGlobalsGroup->AddItem(std::make_shared<BoolCommandItem>("infiniteclip"_J));
weaponsGlobalsGroup->AddItem(std::make_shared<BoolCommandItem>("rapidfire"_J));
weaponsGlobalsGroup->AddItem(std::make_shared<BoolCommandItem>("infiniteparachutes"_J));
weaponsGlobalsGroup->AddItem(std::make_shared<CommandItem>("giveallweapons"_J));
weapons->AddItem(weaponsGlobalsGroup);
@@ -68,7 +69,8 @@ namespace YimMenu::Submenus
vehicleGlobalsGroup->AddItem(std::make_shared<BoolCommandItem>("keepfixed"_J, "Keep Fixed"));
vehicleGlobalsGroup->AddItem(std::make_shared<BoolCommandItem>("hornboost"_J));
vehicleGlobalsGroup->AddItem(std::make_shared<CommandItem>("repairvehicle"_J));
vehicleGlobalsGroup->AddItem(std::make_shared<CommandItem>("enterlastvehicle"_J));
vehicleMiscGroup->AddItem(std::make_shared<BoolCommandItem>("speedometer"_J));
vehicleMiscGroup->AddItem(std::make_shared<BoolCommandItem>("seatbelt"_J));