diff --git a/src/defines.h b/src/defines.h index 7b560e5..02ba2a0 100644 --- a/src/defines.h +++ b/src/defines.h @@ -12,6 +12,8 @@ #define MENU_VERSION MENU_VERSION_NUMBER #define MENU_TITLE MENU_NAME " v" MENU_VERSION + +// Add my custom code to the menu. #define CUSTOM_CODE #ifdef GTASA diff --git a/src/test/test.cpp b/src/test/test.cpp index 9c88195..7cfbb5c 100644 --- a/src/test/test.cpp +++ b/src/test/test.cpp @@ -18,6 +18,10 @@ https://github.com/user-grinch/Cheat-Menu */ + +// Well this was working with the Visual Studio 2022 debugger now it says cannot find gta_sa.exe or gta-vc.exe. +// It still seems to work if I launch the games directly though. + #ifdef GTASA #include "CExplosion.h" // New @@ -29,10 +33,20 @@ #include "CCarAI.h" #include "CCarCtrl.h" #include "CCarEnterExit.h" +#include "CHeli.h" //Misc #include "CCheat.h" +#include "CCoronas.h" +#include "CPickup.h" +#include "CPickups.h" +#include "CWeather.h" +#include "CCheckpoints.h" +#include "CGarages.h" +//Test +#include "CGame.h" +#include "CWaterLevel.h" #endif #define _TEST @@ -47,51 +61,23 @@ #include "utils/util.h" #include "pages/ped.h" +// My code +#include "test_vehicle.h" +#include "test_hud.h" +#include "test_ped.h" + // Well I had this working but then broke it 6-14-2024 @ 3:51PM... // I fixed it 3:53PM. +// TODO Fix this to use translations from the English.toml file instead of hardcoding the values. + TestPage& testPage = TestPage::Get(); TestPage::TestPage() : IPage(ePageID::Test, "Window.TestPage", true) { } -//void TestPage::VehicleTest() { -// // These are neat, the BY_GAME defines seem to have everything in this order: SA, VC, 3. -// // This is under defines.h -// CVehicle* pVeh = BY_GAME(FindPlayerVehicle(-1, false), FindPlayerVehicle(), FindPlayerVehicle()); -// int hVeh = CPools::GetVehicleRef(pVeh); -// -// // If the player is in a vehicle. -// if (pVeh) -// { -// -// } -// -// // There is a lot of these on the sanny builder website. -// // -// // Car, TireId (int) -// // https://library.sannybuilder.com/#/sa/default/04FE -// //Command(hVeh, 1); -// -// // Get car speed -// // https://library.sannybuilder.com/#/sa/default/02E3 -// // -// // Car -// //Command(hVeh); -// -// // Lock car doors -// // https://library.sannybuilder.com/#/sa/default/020A -// // Will this work? -// //Command(hVeh); -// -// // Explode -// // https://library.sannybuilder.com/#/sa/default/020B -// // -// //Command(hVeh); -// -// -//} + //void TestPage::PlayerTest() { // CPlayerPed* player = FindPlayerPed(); @@ -103,12 +89,46 @@ TestPage::TestPage() void PlayerTestFeatures() { CPlayerPed* player = FindPlayerPed(); + + // Not sure how to get the garage id. + // TODO + // + // Work on messing with garages + // https://library.sannybuilder.com/#/sa/classes/Garage + // + // Work on adding objects using code + // Add pickups such as money, health, mines, bombs. + // + // Get, add to and decrement stats. + // https://library.sannybuilder.com/#/sa/classes/Stat + // https://gtamods.com/wiki/List_of_statistics_(SA) + + // Mess around with tasks + // https://library.sannybuilder.com/#/sa/classes/Task + + // Weather + // https://library.sannybuilder.com/#/sa/classes/Weather + + // World + // https://library.sannybuilder.com/#/sa/classes/World + + // Zone + // https://library.sannybuilder.com/#/sa/classes/Zone + + + int hplayer = CPools::GetPedRef(player); CVehicle* pVeh = nullptr; CVector pos = player->GetPosition(); } +bool test = false; +//bool toggleHud = true; +//bool toggleRadar = true; +bool enterCrane = false; +//bool playerCanDrown = true; + void TestPage::Draw() { CPlayerPed* player = FindPlayerPed(); @@ -117,129 +137,59 @@ void TestPage::Draw() { if (ImGui::BeginTabItem(TEXT("Test.TestVehicle"))) { + // This works for seperating out the menus! + // 6-15-2024 @ 2:05PM + ImGui::Text("Hello from KCNet"); ImGui::Text("Vehicle Tab"); + VehicleTestPage::VehicleTestMenu(); //static int selected = Locale::GetCurrentLocaleIndex(); //static std::vector& vec = Locale::GetLocaleList(); - - ImGui::Text("Hello from KCNet"); - if (ImGui::Button("Blow up Car")) - { -#ifdef GTASA - //CPlayerPed* player = FindPlayerPed(); - int hplayer = CPools::GetPedRef(player); - CVehicle* pVeh = nullptr; - - // This actually does work. - bool bInVehicle = Command(hplayer); - if (bInVehicle) - { - CVehicle* pVeh = player->m_pVehicle; - int hVeh = CPools::GetVehicleRef(pVeh); - Command(hVeh); - } -#endif - } - - if (ImGui::Button("Close doors")) - { -#ifdef GTASA - - int hplayer = CPools::GetPedRef(player); - CVehicle* pVeh = nullptr; - - bool bInVehicle = Command(hplayer); - if (bInVehicle) - { - CVehicle* pVeh = player->m_pVehicle; - int hVeh = CPools::GetVehicleRef(pVeh); - Command(hVeh); - } -#endif - } - - // This works for locking the car doors. - if (ImGui::Button("Lock doors")) - { -#ifdef GTASA - - int hplayer = CPools::GetPedRef(player); - CVehicle* pVeh = nullptr; - - bool bInVehicle = Command(hplayer); - if (bInVehicle) - { - CVehicle* pVeh = player->m_pVehicle; - int hVeh = CPools::GetVehicleRef(pVeh); - bool isCarLocked = Command(hVeh); - //bool isCarLocked = player->m_pVehicle->m_eDoorLock; - - // https://library.sannybuilder.com/#/sa/default/020A - // https://library.sannybuilder.com/#/sa/enums/CarLock - if (!isCarLocked) - { - // 2 - Locked - Command(hVeh, 2); - Util::SetMessage("Car has been locked!"); - } - else - { - // 1 - Unlocked - Command(hVeh, 1); - Util::SetMessage("Car has been unlocked!"); - } - } - else - { - // I wonder how to get the last vehicle the player was in to unlock it. - } -#endif - } - //} ImGui::EndTabItem(); } if (ImGui::BeginTabItem(TEXT("Test.TestFeatures"))) { - if (ImGui::Button("Suicide")) - { - //CPlayerPed* player = FindPlayerPed(); - int hplayer = CPools::GetPedRef(player); - Command(hplayer); - } + // Incomplete + PedTestPage::PlayerTestMenu(); + // + //if (ImGui::Button("Suicide")) + //{ + // //CPlayerPed* player = FindPlayerPed(); + // int hplayer = CPools::GetPedRef(player); + // Command(hplayer); + //} - if (ImGui::Button("Bomb")) { - CPlayerPed* player = FindPlayerPed(); - int hplayer = CPools::GetPedRef(player); + //if (ImGui::Button("Bomb")) { + // CPlayerPed* player = FindPlayerPed(); + // int hplayer = CPools::GetPedRef(player); - CVector playerPos = player->GetPosition(); + // CVector playerPos = player->GetPosition(); - // https://library.sannybuilder.com/#/sa/default/020C - // x, y, z, EXPLOSION_CAR - Command(playerPos.x, playerPos.y, playerPos.z, EXPLOSION_CAR); - } + // // https://library.sannybuilder.com/#/sa/default/020C + // // x, y, z, EXPLOSION_CAR + // Command(playerPos.x, playerPos.y, playerPos.z, EXPLOSION_CAR); + //} - if (ImGui::Button("Show coords")) - { - CVector playerCoords = player->GetPosition(); - //std::string text = std::to_string(pos.x) + ", " + std::to_string(pos.y) + ", " + std::to_string(pos.z); - //int playerX = playerCoords.x; - //int playerY = playerCoords.y; - //int playerZ = playerCoords.z; + //if (ImGui::Button("Show coords")) + //{ + // CVector playerCoords = player->GetPosition(); + // //std::string text = std::to_string(pos.x) + ", " + std::to_string(pos.y) + ", " + std::to_string(pos.z); + // //int playerX = playerCoords.x; + // //int playerY = playerCoords.y; + // //int playerZ = playerCoords.z; - std::string playerX = std::to_string(playerCoords.x); - std::string playerY = std::to_string(playerCoords.y); - std::string playerZ = std::to_string(playerCoords.z); + // std::string playerX = std::to_string(playerCoords.x); + // std::string playerY = std::to_string(playerCoords.y); + // std::string playerZ = std::to_string(playerCoords.z); - - - // This works for showing just the X coord, I cannot concatenate these values though - //Util::SetMessage(playerXChar); - // Taken idea from freecam_sa.cpp on line 156 - // This works!! - // 6-14-2024 @ 2:34PM - Util::SetMessage(std::format("X: {} Y: {} Z: {}", playerX, playerY, playerZ).c_str()); - //Util::SetMessage("X: " + playerXChar + " Y: " + playerYChar + " Z: " + playerZChar); - } + // // This works for showing just the X coord, I cannot concatenate these values though + // //Util::SetMessage(playerXChar); + // // Taken idea from freecam_sa.cpp on line 156 + // // This works!! + // // 6-14-2024 @ 2:34PM + // Util::SetMessage(std::format("X: {} Y: {} Z: {}", playerX, playerY, playerZ).c_str()); + // //Util::SetMessage("X: " + playerXChar + " Y: " + playerYChar + " Z: " + playerZChar); + //} //if (ImGui::Button("Show Marker Coords")) //{ @@ -253,16 +203,148 @@ void TestPage::Draw() // //Command(playerPos.x, playerPos.y, playerPos.z, EXPLOSION_CAR); //} + //ImGui::Columns(2, NULL, false); + + - if (ImGui::Button("Blow up all cars")) { #ifdef GTASA - CCheat::BlowUpCarsCheat(); - Util::SetMessage("All cars have been exterminated!"); -#else - Util::SetMessage("Only works for SA!"); -#endif + //ImGui::NextColumn(); + // https://github.com/JuniorDjjr/CLEOPlus/blob/main/CLEOPlus/Misc.cpp#L261-L266 + // reinterpret_cast(thread)->UpdateCompareFlag(CCheat::m_aCheatsActive[i]); + + + // I wonder how to spawn a different pickup + if (ImGui::Button("Health pickup")) + { + CVector playerPos = player->GetPosition(); + int playerX = playerPos.x; + int playerY = playerPos.y; + int playerZ = playerPos.z; + + // Needs some more arguments. + //CPickup::GiveUsAPickUpObject(CObject::, -1); + //CPickups::CreatePickupCoorsCloseToCoors(playerPos.x, playerPos.y, playerPos.z); } + + //ImGui::SameLine(); + + ImGui::Text("Spawn 50k near your position"); + if (ImGui::Button("Money pickup")) + { + CVector playerPos = player->GetPosition(); + CVector newPos = CVector(playerPos.x + 3, playerPos.y + 3, playerPos.z); + + CPickups::CreateSomeMoney(newPos, 50000); + Util::SetMessage("You have spawned 50k near you!"); + } + ImGui::Separator(); + + // Not sure how this one works + //CCheckpoints::PlaceMarker(); + if (ImGui::Button("Create Checkpoint")) + { + + } + ImGui::SameLine(); + ImGui::Text("Doesn't work!"); + + if (ImGui::Button("Remove checkpoint")) + { + + } + ImGui::SameLine(); + ImGui::Text("Doesn't work!"); + + // Hud functions + HudTestPage::HudTestMenu(); + + // Not sure how these work. + // https://library.sannybuilder.com/#/sa/classes/Crane + if (ImGui::Checkbox("Enter Crane", &enterCrane)) + { + if(enterCrane) + { + // https://library.sannybuilder.com/#/sa/default/079D + Command(); + } + else + { + // https://library.sannybuilder.com/#/sa/default/079F + Command(); + } + } + + // This seems to work fine. + //if (ImGui::Checkbox("Player drowns", &playerCanDrown)) + //{ + // int hPlayer = CPools::GetPedRef(player); + // if (!playerCanDrown) { + // Command(hPlayer, false); + // Util::SetMessage("You can no longer drown!"); + // } + // else + // { + // Command(hPlayer, true); + // Util::SetMessage("You can now drown again!"); + + // } + //} + + // This works + if (ImGui::Button("Play Mission Passed")) + { + // https://library.sannybuilder.com/#/sa/default/0394 + Command(1); + //bool isFlyingActive = CCheat::m_aCheatsActive); + //Util::SetMessage(std::format("Is Flying Active: {}", isFlyingActive).c_str()); + } + + // Doesn't work +// if (ImGui::Button("Show corona")) +// { + // I wonder How I would use this? + // I would need to define it somehow + //CCorona + //CCoronas::RegisterCorona(); +// } + + /* + * void PedPage::AddNewPed() + Example for what i'm trying to do spawning in a ped. + Command(model); + Command(); + if (Command(model)) + { + std::string key = std::format("Custom.{} (Added)", name); + m_PedData.m_pData->Set(key.c_str(), std::to_string(model)); + m_PedData.m_pData->Save(); + Util::SetMessage(TEXT("Ped.AddPedMSG")); + Command(model); + } + else + { + Util::SetMessage(TEXT("Vehicle.InvalidID")); + } + */ + + // First request the model + // Then load all models + // Lastly check if the model is available. + // If not say "Invalid model" + + // + //if (ImGui::Button("Spawn Ped")) + //{ + // //CPed* pPed = new CPed::; + // //CWaterLevel:: + // //CWorld::Add() + //} + + // Clothes + +#endif + //if (ImGui::Button("Spawn ped to attack vehicle")) //{ // Util::SetMessage("Not setup!"); diff --git a/src/test/test.h b/src/test/test.h index 704b602..5a348c5 100644 --- a/src/test/test.h +++ b/src/test/test.h @@ -21,5 +21,3 @@ public: }; extern TestPage& testPage; - -// This doesn't do anything yet, I would like to add a custom tab to the Cheat menu \ No newline at end of file diff --git a/src/test/test_hud.cpp b/src/test/test_hud.cpp new file mode 100644 index 0000000..a999bd8 --- /dev/null +++ b/src/test/test_hud.cpp @@ -0,0 +1,38 @@ +#include "pch.h" +#include "test_hud.h" + +bool toggleHud = true; +bool toggleRadar = true; + +void HudTestPage::HudTestMenu() +{ + +// GTA SA Specific memory addresses, will most likely crash 3 and vc. +#ifdef GTASA + if (ImGui::Checkbox("Toggle hud", &toggleHud)) + { + // hudModeAddress = 0xBA6769; + if (!toggleHud) + { + patch::Set(0xBA6769, 0, true); + } + else + { + patch::Set(0xBA6769, 1, true); + } + } + + if (ImGui::Checkbox("Toggle Radar", &toggleRadar)) + { + // radarModeAddress = 0xBA676C + if (!toggleRadar) + { + patch::Set(0xBA676C, 2, true); + } + else + { + patch::Set(0xBA676C, 0, true); + } + } +#endif //GTASA +} \ No newline at end of file diff --git a/src/test/test_hud.h b/src/test/test_hud.h new file mode 100644 index 0000000..5519b40 --- /dev/null +++ b/src/test/test_hud.h @@ -0,0 +1,12 @@ +#pragma once +//#include "pch.h" + +class HudTestPage +{ +private: + HudTestPage(); + HudTestPage(const HudTestPage&); + void Draw(); +public: + static void HudTestMenu(); +}; diff --git a/src/test/test_ped.cpp b/src/test/test_ped.cpp new file mode 100644 index 0000000..f9dfd66 --- /dev/null +++ b/src/test/test_ped.cpp @@ -0,0 +1,93 @@ +#include "pch.h" +#include "test_ped.h" + +#ifdef GTASA +#include "CExplosion.h" +#endif + +// Incomplete. + +bool playerCanDrown = true; + +void PedTestPage::PlayerTestMenu() +{ +#ifdef GTASA + CPlayerPed* player = FindPlayerPed(); + if (ImGui::Button("Suicide")) + { + //CPlayerPed* player = FindPlayerPed(); + int hplayer = CPools::GetPedRef(player); + Command(hplayer); + } +#else + CPlayerPed* player = FindPlayerPed(); +#endif //GTASA + +#ifdef GTASA + //TODO Test these in the other games, 3 and vc later! + if (ImGui::Button("Bomb")) { + CPlayerPed* player = FindPlayerPed(); + int hplayer = CPools::GetPedRef(player); + + CVector playerPos = player->GetPosition(); + + // https://library.sannybuilder.com/#/sa/default/020C + // x, y, z, EXPLOSION_CAR + Command(playerPos.x, playerPos.y, playerPos.z, EXPLOSION_CAR); + } +#endif //GTASA + +#ifdef GTASA + if (ImGui::Button("Show coords")) + { + CVector playerCoords = player->GetPosition(); + //std::string text = std::to_string(pos.x) + ", " + std::to_string(pos.y) + ", " + std::to_string(pos.z); + //int playerX = playerCoords.x; + //int playerY = playerCoords.y; + //int playerZ = playerCoords.z; + + std::string playerX = std::to_string(playerCoords.x); + std::string playerY = std::to_string(playerCoords.y); + std::string playerZ = std::to_string(playerCoords.z); + + // This works for showing just the X coord, I cannot concatenate these values though + //Util::SetMessage(playerXChar); + // Taken idea from freecam_sa.cpp on line 156 + // This works!! + // 6-14-2024 @ 2:34PM + Util::SetMessage(std::format("X: {} Y: {} Z: {}", playerX, playerY, playerZ).c_str()); + //Util::SetMessage("X: " + playerXChar + " Y: " + playerYChar + " Z: " + playerZChar); + + } +#endif //GTASA + + //if (ImGui::Button("Show Marker Coords")) + //{ + + // if (Command()) + // { + // // Check if the target marker blip exists and print the coords if so, looks like this function is only available in cleo. + // // GET_TARGET_BLIP_COORDS + // //if() + // } + // //Command(playerPos.x, playerPos.y, playerPos.z, EXPLOSION_CAR); + + //} + //ImGui::Columns(2, NULL, false); +#ifdef GTASA + + if (ImGui::Checkbox("Player drowns", &playerCanDrown)) + { + int hPlayer = CPools::GetPedRef(player); + if (!playerCanDrown) { + Command(hPlayer, false); + Util::SetMessage("You can no longer drown!"); + } + else + { + Command(hPlayer, true); + Util::SetMessage("You can now drown again!"); + } + } +#endif //GTASA +} \ No newline at end of file diff --git a/src/test/test_ped.h b/src/test/test_ped.h new file mode 100644 index 0000000..cd20595 --- /dev/null +++ b/src/test/test_ped.h @@ -0,0 +1,13 @@ +#pragma once +//#include "pch.h" + +class PedTestPage +{ +private: + PedTestPage(); + PedTestPage(const PedTestPage&); + void Draw(); +public: + //static void PedTestMenu(); + static void PlayerTestMenu(); +}; diff --git a/src/test/test_teleport.cpp b/src/test/test_teleport.cpp new file mode 100644 index 0000000..e996f60 --- /dev/null +++ b/src/test/test_teleport.cpp @@ -0,0 +1,8 @@ +#include "pch.h" +#include "test_teleport.h" + +// Incomplete +void TeleportTestPage::TestTeleportMenu() +{ + +} \ No newline at end of file diff --git a/src/test/test_teleport.h b/src/test/test_teleport.h new file mode 100644 index 0000000..39a08b0 --- /dev/null +++ b/src/test/test_teleport.h @@ -0,0 +1,12 @@ +#pragma once +//#include "pch.h" + +class TeleportTestPage +{ +private: + TeleportTestPage(); + TeleportTestPage(const TeleportTestPage&); + void Draw(); +public: + static void TestTeleportMenu(); +}; diff --git a/src/test/test_vehicle.cpp b/src/test/test_vehicle.cpp new file mode 100644 index 0000000..d3c94b4 --- /dev/null +++ b/src/test/test_vehicle.cpp @@ -0,0 +1,268 @@ +#include "pch.h" +#include "test_vehicle.h" + +//void TestPage::VehicleTest() { +// // These are neat, the BY_GAME defines seem to have everything in this order: SA, VC, 3. +// // This is under defines.h +// CVehicle* pVeh = BY_GAME(FindPlayerVehicle(-1, false), FindPlayerVehicle(), FindPlayerVehicle()); +// int hVeh = CPools::GetVehicleRef(pVeh); +// +// // If the player is in a vehicle. +// if (pVeh) +// { +// +// } +// +// // There is a lot of these on the sanny builder website. +// // +// // Car, TireId (int) +// // https://library.sannybuilder.com/#/sa/default/04FE +// //Command(hVeh, 1); +// +// // Get car speed +// // https://library.sannybuilder.com/#/sa/default/02E3 +// // +// // Car +// //Command(hVeh); +// +// // Lock car doors +// // https://library.sannybuilder.com/#/sa/default/020A +// // Will this work? +// //Command(hVeh); +// +// // Explode +// // https://library.sannybuilder.com/#/sa/default/020B +// // +// //Command(hVeh); +// +// +//} + +// This is mostly specific to GTA SA and has been disabled for 3 and vc, I cannot get this to work on VC anyways. + +bool bFlyingCars = false; +bool bSearchLight = false; +bool bVehGodMode = false; + +void VehicleTestPage::VehicleTestMenu() { +#ifdef GTASA + CPlayerPed* player = FindPlayerPed(); + int hplayer = CPools::GetPedRef(player); + CVehicle* pVeh = nullptr; + CVector pos = player->GetPosition(); + + if (ImGui::Button("Blow up all cars")) { + + CCheat::BlowUpCarsCheat(); + Util::SetMessage("All cars have been exterminated!"); +#else + Util::SetMessage("Only works for SA!"); +#endif + } + +#ifdef GTASA + // Try to toggle the search lights in police helicopters, is it toggleable in SA? I think I did it in FiveM. + if (ImGui::Checkbox("Search Light", &bSearchLight)) + { + int hPlayer = CPools::GetPedRef(player); + CVehicle* pVeh = nullptr; + + bool bInVehicle = Command(hPlayer); + bool bInHeli = Command(hPlayer); + + //bool vehicleSearchLight = Command + if (bInHeli) + { + //CHeli::AddHeliSearchLight(); + } + } +#endif //GTASA + // https://github.com/JuniorDjjr/CLEOPlus/blob/main/CLEOPlus/Misc.cpp#L261-L266 + /* + reinterpret_cast(thread)->UpdateCompareFlag(CCheat::m_aCheatsActive[i]); + */ + +#ifdef GTASA + if (ImGui::Button("Blow up Current Car")) + { + + //CPlayerPed* player = FindPlayerPed(); + int hplayer = CPools::GetPedRef(player); + CVehicle* pVeh = nullptr; + + // This actually does work. + bool bInVehicle = Command(hplayer); + if (bInVehicle) + { + CVehicle* pVeh = player->m_pVehicle; + int hVeh = CPools::GetVehicleRef(pVeh); + Command(hVeh); + } + + } +#endif //GTASA + +#ifdef GTASA + // Works for closing the doors, not the trunk or hood though. + if (ImGui::Button("Close doors")) + { + + + int hplayer = CPools::GetPedRef(player); + CVehicle* pVeh = nullptr; + + bool bInVehicle = Command(hplayer); + if (bInVehicle) + { + CVehicle* pVeh = player->m_pVehicle; + int hVeh = CPools::GetVehicleRef(pVeh); + Command(hVeh); + } + } +#endif //GTASA + +#ifdef GTASA + // This works for locking the car doors. + if (ImGui::Button("Lock doors")) + { + + + int hplayer = CPools::GetPedRef(player); + CVehicle* pVeh = nullptr; + + bool bInVehicle = Command(hplayer); + if (bInVehicle) + { + CVehicle* pVeh = player->m_pVehicle; + int hVeh = CPools::GetVehicleRef(pVeh); + bool isCarLocked = Command(hVeh); + //bool isCarLocked = player->m_pVehicle->m_eDoorLock; + + // https://library.sannybuilder.com/#/sa/default/020A + // https://library.sannybuilder.com/#/sa/enums/CarLock + if (!isCarLocked) + { + // 2 - Locked + Command(hVeh, 2); + Util::SetMessage("Car has been locked!"); + } + else + { + // 1 - Unlocked + Command(hVeh, 1); + Util::SetMessage("Car has been unlocked!"); + } + } + else + { + // I wonder how to get the last vehicle the player was in to unlock it. + } + } +#endif //GTASA + //} + + // This works +#ifdef GTASA + if (ImGui::Checkbox("Flying cars", &bFlyingCars)) + { + // In cleo redux I can read and write to memory addresses, not sure how on here. + // I figured it out in the below code using a function in this menu. + // Example: + /* + * (Written in JavaScript) + player.clearWantedLevel(); + Memory.Write(0x969171, 1, 1, false); + + // Flying cars cheat. + */ + + // Idea for this game from game.cpp on line 359 + if (bFlyingCars) + { + patch::Set(0x969160, 1, true); + Util::SetMessage("Cars can now fly!"); + } + else + { + patch::Set(0x969160, 0, true); + Util::SetMessage("Cars can no longer fly!"); + } + // CallDynGlobal seems to be what they are using for cheats in the plugin-sdk + //CallDynGlobal<0x969160>; + // Gives an error though + } +#endif //GTASA + +#ifdef GTASA + + // This works, this was a quick test I came up with. + if (ImGui::Checkbox("Invincible car", &bVehGodMode)) + { + int hplayer = CPools::GetPedRef(player); + CVehicle* pVeh = nullptr; + + bool bInVehicle = Command(hplayer); + if (bInVehicle) + { + CVehicle* pVeh = player->m_pVehicle; + int hVeh = CPools::GetVehicleRef(pVeh); +#ifdef GTASA + bool isCarLocked = Command(hVeh); +#endif //GTASA + //bool isCarLocked = player->m_pVehicle->m_eDoorLock; + + if (bVehGodMode) + { + // Car, bulletProof, fireProof, explosionProof, meleeProof + // https://library.sannybuilder.com/#/sa/default/02AC + Command(hVeh, true, true, true, true, true); + Util::SetMessage("Your car now has god mode!"); + } + else + { + Command(hVeh, false, false, false, false, false); + Util::SetMessage("Your car no longer has god mode!"); + } + } + } +#endif //GTASA + +#ifdef GTASA + // Working + if (ImGui::Button("Is car in water")) + { + int hplayer = CPools::GetPedRef(player); + CVehicle* pVeh = nullptr; + bool bInVehicle = Command(hplayer); + + if (bInVehicle) { + CVehicle* pVeh = player->m_pVehicle; + int hVeh = CPools::GetVehicleRef(pVeh); + // https://library.sannybuilder.com/#/sa/default/04D8 + bool isCarInWater = Command(hVeh); + + if (!isCarInWater) + { + Util::SetMessage("Your car is dry."); + } + else + { + Util::SetMessage("Your car is in the water."); + } + } + else + { + Util::SetMessage("You are not in a car!"); + } + } +} +#endif //GTASA + + + +// void VehiclePage::Draw() +//void VehicleTestPage::Draw() +//{ +// // Draw the test menu with a couple of cheats. +// VehicleTestMenu(); +//} diff --git a/src/test/test_vehicle.h b/src/test/test_vehicle.h new file mode 100644 index 0000000..6a33f83 --- /dev/null +++ b/src/test/test_vehicle.h @@ -0,0 +1,12 @@ +#pragma once +//#include "pch.h" + +class VehicleTestPage +{ +private: + VehicleTestPage(); + VehicleTestPage(const VehicleTestPage&); + void Draw(); +public: + static void VehicleTestMenu(); +};