From e8e03e3ccdb177ee9e2bc149a996b25bdaac52ba Mon Sep 17 00:00:00 2001 From: Arthur <121949966+ShinyWasabi@users.noreply.github.com> Date: Thu, 26 Jun 2025 23:05:36 +0300 Subject: [PATCH] Some Fixes & Improvements (#571) --- src/game/features/players/troll/SendGooch.cpp | 32 +++++++++++++++++++ .../features/players/troll/SendPhantomCar.cpp | 32 +++++++++++++++++++ src/game/frontend/items/CommandItem.cpp | 2 +- src/game/frontend/submenus/Debug/Scripts.cpp | 1 + src/game/frontend/submenus/Player/Troll.cpp | 2 ++ src/game/frontend/submenus/Recovery.cpp | 6 ++-- src/game/frontend/submenus/Self.cpp | 2 +- .../frontend/submenus/Settings/LuaScripts.cpp | 2 +- src/game/frontend/submenus/Teleport.cpp | 4 --- .../submenus/Vehicle/SpawnVehicle.cpp | 18 +++++------ src/game/frontend/submenus/World/SpawnPed.cpp | 2 +- src/game/gta/Vehicle.cpp | 19 ++++++++--- 12 files changed, 98 insertions(+), 24 deletions(-) create mode 100644 src/game/features/players/troll/SendGooch.cpp create mode 100644 src/game/features/players/troll/SendPhantomCar.cpp diff --git a/src/game/features/players/troll/SendGooch.cpp b/src/game/features/players/troll/SendGooch.cpp new file mode 100644 index 0000000..0ad0e7b --- /dev/null +++ b/src/game/features/players/troll/SendGooch.cpp @@ -0,0 +1,32 @@ +#include "game/commands/PlayerCommand.hpp" +#include "core/backend/ScriptMgr.hpp" +#include "game/gta/Scripts.hpp" +#include "types/script/ScriptEvent.hpp" +#include "types/script/globals/GSBD_RandomEvents.hpp" + +namespace YimMenu::Features +{ + class SendGooch : public PlayerCommand + { + using PlayerCommand::PlayerCommand; + + virtual void OnCall(Player player) override + { + Scripts::ForceScriptHost(Scripts::FindScriptThread("freemode"_J)); + + if (auto GSBDRandomEvents = GSBD_RandomEvents::Get()) + { + SCRIPT_EVENT_REQUEST_RANDOM_EVENT data; + data.FMMCType = 310; + data.PlayersToSend = 1; + data.Send(); + + ScriptMgr::Yield(); + + GSBDRandomEvents->TargetData.XMASMuggerTarget = player.GetId(); + } + } + }; + + static SendGooch _SendGooch{"sendgooch", "Send Gooch", "Sends the Gooch to the specified player."}; +} \ No newline at end of file diff --git a/src/game/features/players/troll/SendPhantomCar.cpp b/src/game/features/players/troll/SendPhantomCar.cpp new file mode 100644 index 0000000..e43aa6d --- /dev/null +++ b/src/game/features/players/troll/SendPhantomCar.cpp @@ -0,0 +1,32 @@ +#include "game/commands/PlayerCommand.hpp" +#include "core/backend/ScriptMgr.hpp" +#include "game/gta/Scripts.hpp" +#include "types/script/ScriptEvent.hpp" +#include "types/script/globals/GSBD_RandomEvents.hpp" + +namespace YimMenu::Features +{ + class SendPhantomCar : public PlayerCommand + { + using PlayerCommand::PlayerCommand; + + virtual void OnCall(Player player) override + { + Scripts::ForceScriptHost(Scripts::FindScriptThread("freemode"_J)); + + if (auto GSBDRandomEvents = GSBD_RandomEvents::Get()) + { + SCRIPT_EVENT_REQUEST_RANDOM_EVENT data; + data.FMMCType = 269; + data.PlayersToSend = 1; + data.Send(); + + ScriptMgr::Yield(); + + GSBDRandomEvents->TargetData.PhantomCarTarget = player.GetId(); + } + } + }; + + static SendPhantomCar _SendPhantomCar{"sendphantomcar", "Send Phantom Car", "Sends the Phantom Car to the specified player."}; +} \ No newline at end of file diff --git a/src/game/frontend/items/CommandItem.cpp b/src/game/frontend/items/CommandItem.cpp index 5846f26..bf72ff3 100644 --- a/src/game/frontend/items/CommandItem.cpp +++ b/src/game/frontend/items/CommandItem.cpp @@ -35,7 +35,7 @@ namespace YimMenu if (ImGui::IsItemHovered()) { ImGui::SetTooltip("%s", m_Command->GetDescription().data()); - if (GetAsyncKeyState(VK_SHIFT) & 0x8000) + if (GetAsyncKeyState(VK_CAPITAL) & 0x8000) ImGui::OpenPopup(std::format("{} Hotkey", m_Command->GetLabel()).data()); } diff --git a/src/game/frontend/submenus/Debug/Scripts.cpp b/src/game/frontend/submenus/Debug/Scripts.cpp index 264570d..f9d63eb 100644 --- a/src/game/frontend/submenus/Debug/Scripts.cpp +++ b/src/game/frontend/submenus/Debug/Scripts.cpp @@ -245,6 +245,7 @@ namespace YimMenu::Submenus if (ImGui::TreeNode("Bytecode")) { RenderBytecode(curProgram); + ImGui::TreePop(); } } })); diff --git a/src/game/frontend/submenus/Player/Troll.cpp b/src/game/frontend/submenus/Player/Troll.cpp index eb4a312..fe124d3 100644 --- a/src/game/frontend/submenus/Player/Troll.cpp +++ b/src/game/frontend/submenus/Player/Troll.cpp @@ -11,6 +11,8 @@ namespace YimMenu::Submenus auto vehicle = std::make_shared("Vehicle"); general->AddItem(std::make_shared("sendsext"_J)); + general->AddItem(std::make_shared("sendphantomcar"_J)); + general->AddItem(std::make_shared("sendgooch"_J)); bounty->AddItem(std::make_shared("bountyamount"_J, "Amount")); bounty->AddItem(std::make_shared("anonymousbounty"_J, "Anonymous")); diff --git a/src/game/frontend/submenus/Recovery.cpp b/src/game/frontend/submenus/Recovery.cpp index a7c5344..aef57dd 100644 --- a/src/game/frontend/submenus/Recovery.cpp +++ b/src/game/frontend/submenus/Recovery.cpp @@ -11,7 +11,7 @@ namespace YimMenu::Submenus #define ICON_FA_SACK_DOLLAR "\xef\x93\x80" Submenu::Submenu("Recovery", ICON_FA_SACK_DOLLAR) { - auto missions = std::make_shared("Missions"); + auto main = std::make_shared("Main"); auto businesses = std::make_shared("Businesses"); auto casino = std::make_shared("Casino"); @@ -36,11 +36,11 @@ namespace YimMenu::Submenus casinoSlots->AddItem(std::make_shared("casinomanipulaterigslotmachines"_J)); - missions->AddItem(generalGroup); + main->AddItem(generalGroup); businesses->AddItem(businessGroup); casino->AddItem(casinoSlots); - AddCategory(std::move(missions)); + AddCategory(std::move(main)); AddCategory(std::move(businesses)); AddCategory(std::move(casino)); AddCategory(BuildStatEditorMenu()); diff --git a/src/game/frontend/submenus/Self.cpp b/src/game/frontend/submenus/Self.cpp index 982459b..7671ba8 100644 --- a/src/game/frontend/submenus/Self.cpp +++ b/src/game/frontend/submenus/Self.cpp @@ -20,7 +20,7 @@ namespace YimMenu::Submenus globalsGroup->AddItem(std::make_shared("godmode"_J)); globalsGroup->AddItem(std::make_shared("invis"_J)); - movementGroup->AddItem(std::make_shared("invis"_J, std::make_shared("localvis"_J))); + globalsGroup->AddItem(std::make_shared("invis"_J, std::make_shared("localvis"_J))); globalsGroup->AddItem(std::make_shared("otr"_J)); globalsGroup->AddItem(std::make_shared("noragdoll"_J)); globalsGroup->AddItem(std::make_shared("noidlekick"_J)); diff --git a/src/game/frontend/submenus/Settings/LuaScripts.cpp b/src/game/frontend/submenus/Settings/LuaScripts.cpp index 51dfeee..01b6e45 100644 --- a/src/game/frontend/submenus/Settings/LuaScripts.cpp +++ b/src/game/frontend/submenus/Settings/LuaScripts.cpp @@ -14,7 +14,7 @@ namespace YimMenu::Submenus menu->AddItem(std::make_unique([] { const float height = 15 * ImGui::GetTextLineHeightWithSpacing(); - if (ImGui::BeginListBox("##vehicles", {300.f, height})) + if (ImGui::BeginListBox("##luascripts", {300.f, height})) { static std::optional loadingScript; diff --git a/src/game/frontend/submenus/Teleport.cpp b/src/game/frontend/submenus/Teleport.cpp index d4d1070..c343964 100644 --- a/src/game/frontend/submenus/Teleport.cpp +++ b/src/game/frontend/submenus/Teleport.cpp @@ -174,10 +174,6 @@ namespace YimMenu::Submenus miscGroup->AddItem(std::make_shared("autotptowaypoint"_J, std::make_shared("tptowaypoint"_J), true)); miscGroup->AddItem(std::make_shared("autotptowaypoint"_J)); - // miscGroup->AddItem(std::make_shared("tptomount"_J)); - // miscGroup->AddItem(std::make_shared("tptotraintrack"_J)); - // miscGroup->AddItem(std::make_shared("tptomoonshineshack"_J)); - // miscGroup->AddItem(std::make_shared("tptonazar"_J)); miscGroup->AddItem(std::make_shared("tptoobjective"_J)); main->AddItem(miscGroup); diff --git a/src/game/frontend/submenus/Vehicle/SpawnVehicle.cpp b/src/game/frontend/submenus/Vehicle/SpawnVehicle.cpp index 06d04ba..86a1653 100644 --- a/src/game/frontend/submenus/Vehicle/SpawnVehicle.cpp +++ b/src/game/frontend/submenus/Vehicle/SpawnVehicle.cpp @@ -1,4 +1,5 @@ #include "SpawnVehicle.hpp" +#include "core/commands/BoolCommand.hpp" #include "core/backend/ScriptMgr.hpp" #include "core/backend/FiberPool.hpp" #include "game/backend/Self.hpp" @@ -8,6 +9,9 @@ namespace YimMenu::Submenus { + static BoolCommand spawnInsideVehicle{"spawninsideveh", "Spawn Inside", "Spawn inside the vehicle."}; + static BoolCommand spawnVehicleMaxed{"spawnvehmaxed", "Spawn Maxed", "Spawn the vehicle maxed."}; + static Vector3 GetVehicleSpawnLoc(joaat_t hash, bool spawnInside) { float y_offset = 0; @@ -34,8 +38,6 @@ namespace YimMenu::Submenus static std::vector vehicleNames{}; static std::vector vehicleClasses{}; static int selectedClass{-1}; - static bool spawnInside{}; - static bool spawnMaxed{}; menu->AddItem(std::make_unique([] { static bool init = [] { @@ -118,12 +120,12 @@ namespace YimMenu::Submenus if (ImGui::Selectable(name.c_str())) { FiberPool::Push([hash] { - auto handle = Vehicle::Create(hash, GetVehicleSpawnLoc(hash, spawnInside), Self::GetPed().GetHeading()); + auto handle = Vehicle::Create(hash, GetVehicleSpawnLoc(hash, spawnInsideVehicle.GetState()), Self::GetPed().GetHeading()); - if (spawnInside) + if (spawnInsideVehicle.GetState()) Self::GetPed().SetInVehicle(handle); - if (spawnMaxed) + if (spawnVehicleMaxed.GetState()) handle.Upgrade(); }); } @@ -133,12 +135,10 @@ namespace YimMenu::Submenus ImGui::EndListBox(); } - - ImGui::Checkbox("Spawn Inside", &spawnInside); - ImGui::SameLine(); - ImGui::Checkbox("Spawn Maxed", &spawnMaxed); })); + menu->AddItem(std::make_shared("spawninsideveh"_J)); + menu->AddItem(std::make_shared("spawnvehmaxed"_J)); return menu; } } \ No newline at end of file diff --git a/src/game/frontend/submenus/World/SpawnPed.cpp b/src/game/frontend/submenus/World/SpawnPed.cpp index b1e0d56..1138a7a 100644 --- a/src/game/frontend/submenus/World/SpawnPed.cpp +++ b/src/game/frontend/submenus/World/SpawnPed.cpp @@ -33,7 +33,7 @@ namespace YimMenu::Submenus const int visible = std::min(20, static_cast(g_PedModels.size())); const float height = visible * ImGui::GetTextLineHeightWithSpacing(); - if (ImGui::BeginListBox("##vehicles", {300.f, height})) + if (ImGui::BeginListBox("##peds", {300.f, height})) { std::string lower = search; std::transform(lower.begin(), lower.end(), lower.begin(), ::tolower); diff --git a/src/game/gta/Vehicle.cpp b/src/game/gta/Vehicle.cpp index 3813bc9..ab4d190 100644 --- a/src/game/gta/Vehicle.cpp +++ b/src/game/gta/Vehicle.cpp @@ -58,11 +58,22 @@ namespace YimMenu ENTITY_ASSERT_CONTROL(); ENTITY_ASSERT_SCRIPT_CONTEXT(); - if (VEHICLE::GET_DOES_VEHICLE_HAVE_DAMAGE_DECALS(GetHandle())) + if (!VEHICLE::GET_DOES_VEHICLE_HAVE_DAMAGE_DECALS(GetHandle())) + return; + + // this is what carmod_shop does to repair your vehicle + VEHICLE::SET_VEHICLE_FIXED(GetHandle()); + ENTITY::SET_ENTITY_HEALTH(GetHandle(), 1000, 0, 0); + VEHICLE::SET_VEHICLE_ENGINE_HEALTH(GetHandle(), 1000.f); + VEHICLE::SET_VEHICLE_PETROL_TANK_HEALTH(GetHandle(), 1000.f); + VEHICLE::SET_VEHICLE_DIRT_LEVEL(GetHandle(), 0.f); + GRAPHICS::REMOVE_DECALS_FROM_VEHICLE(GetHandle()); + ENTITY::FORCE_ENTITY_AI_AND_ANIMATION_UPDATE(GetHandle()); + /*if (ENTITY::GET_ENTITY_MODEL(GetHandle()) == "brawler"_J) { - VEHICLE::SET_VEHICLE_FIXED(GetHandle()); - VEHICLE::SET_VEHICLE_DIRT_LEVEL(GetHandle(), 0); - } + VEHICLE::SET_VEHICLE_ON_GROUND_PROPERLY(GetHandle(), 1084227584); + PHYSICS::ACTIVATE_PHYSICS(GetHandle()); + }*/ } int Vehicle::GetGear()