diff --git a/README.md b/README.md index 40903a8..893bfe6 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ A portuguese translation of the menu is [here](https://github.com/Dowglass/Cheat 1. Install [DirectX9](https://www.microsoft.com/en-us/download/details.aspx?id=35) & [Visual C++ Redistributable 2015 x86](https://download.microsoft.com/download/9/3/F/93FCF1E7-E6A4-478B-96E7-D4B285925B00/vc_redist.x86.exe) if not already installed. 2. If your game version isn't v1.0 then you'll need to [downgrade](https://gtaforums.com/topic/927016-san-andreas-downgrader/). -3. Install asi loader from [here](https://www.gtagarage.com/mods/show.php?id=21709) +3. Install [asi loader](https://www.gtagarage.com/mods/show.php?id=21709) & [silent patch](https://gtaforums.com/topic/669045-silentpatch/) 4. Download CheatMenu and extract everything in game directory (replace if necessary). ## Building diff --git a/src/CheatMenu.cpp b/src/CheatMenu.cpp index 6ea78d7..0d7f770 100644 --- a/src/CheatMenu.cpp +++ b/src/CheatMenu.cpp @@ -48,14 +48,11 @@ CheatMenu::CheatMenu() Events::initRwEvent += []() { - flog << "Log Started." << std::endl; - // Load menu settings Globals::header_id = config.GetValueStr("window.id",""); Globals::menu_size.x = config.GetValue("window.sizeX", screen::GetScreenWidth() / 4.0f); Globals::menu_size.y = config.GetValue("window.sizeY", screen::GetScreenHeight() / 1.2f); srand(CTimer::m_snTimeInMilliseconds); - }; Events::processScriptsEvent += [this] @@ -74,13 +71,12 @@ CheatMenu::CheatMenu() Globals::last_key_timer = CTimer::m_snTimeInMilliseconds; } - bool windows_visible = Globals::show_menu || Menu::commands::show_menu; - if (Hook::show_mouse != windows_visible) + if (Hook::show_mouse != Globals::show_menu) { if (Hook::show_mouse) // Only write when the menu closes config.WriteToDisk(); - Hook::show_mouse = windows_visible; + Hook::show_mouse = Globals::show_menu; } } }; diff --git a/src/CheatMenu.h b/src/CheatMenu.h index 6fd4746..7cf57e6 100644 --- a/src/CheatMenu.h +++ b/src/CheatMenu.h @@ -49,6 +49,16 @@ public: launch = false; } + /* + WndProc is extremely buggy without SilentPatch + Should have a better fix for this but everyone should have + SilentPatch installed so mehh... + */ + if (!GetModuleHandleA("SilentPatchSA.asi")) { + MessageBox(HWND_DESKTOP, "SilentPatch isn't installed. Exiting CheatMenu.", "CheatMenu", MB_ICONERROR); + launch = false; + } + if (launch) { flog << "Loading CheatMenu" << std::endl; diff --git a/src/Hook.cpp b/src/Hook.cpp index 0000e25..9451734 100644 --- a/src/Hook.cpp +++ b/src/Hook.cpp @@ -15,6 +15,7 @@ std::function Hook::window_func = NULL; LRESULT Hook::InputProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { + ImGui_ImplWin32_WndProcHandler(hWnd, uMsg, wParam, lParam); if (ImGui::GetIO().WantTextInput) @@ -24,6 +25,7 @@ LRESULT Hook::InputProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam } else return CallWindowProc(oWndProc, hWnd, uMsg, wParam, lParam); + } HRESULT Hook::ResetDx9(IDirect3DDevice9 * pDevice, D3DPRESENT_PARAMETERS * pPresentationParameters) diff --git a/src/Teleport.cpp b/src/Teleport.cpp index af759cf..8f56adf 100644 --- a/src/Teleport.cpp +++ b/src/Teleport.cpp @@ -91,8 +91,9 @@ Teleport::Teleport() void Teleport::TeleportPlayer(bool get_marker, CVector* pos, short interior_id) { - CPlayerPed* player = FindPlayerPed(); - + CPlayerPed *player = FindPlayerPed(); + CVehicle *pVeh = player->m_pVehicle; + if (get_marker) { auto target_blip = CRadar::ms_RadarTrace[LOWORD(FrontEndMenuManager.m_nTargetBlipIndex)]; @@ -118,15 +119,19 @@ void Teleport::TeleportPlayer(bool get_marker, CVector* pos, short interior_id) CStreaming::LoadSceneCollision(&Teleport::STeleport::pos); CStreaming::LoadAllRequestedModels(false); - if (player->m_pVehicle) + if (pVeh) { - player->m_pVehicle->Teleport(CVector(pos->x, pos->y, pos->z), false); - Command(CPools::GetVehicleRef(player->m_pVehicle), interior_id); // setvehicleinterior + pVeh->Teleport(CVector(pos->x, pos->y, pos->z), false); + + if (pVeh->m_nVehicleClass == VEHICLE_BIKE) + reinterpret_cast(pVeh)->PlaceOnRoadProperly(); + else if (pVeh->m_nVehicleClass != VEHICLE_BOAT) + reinterpret_cast(pVeh)->PlaceOnRoadProperly(); + + pVeh->m_nAreaCode = interior_id; } else player->Teleport(CVector(pos->x, pos->y, pos->z), false); - - Command(CPools::GetPedRef(player), interior_id); // setcharinterior Command(interior_id); } diff --git a/src/Ui.cpp b/src/Ui.cpp index 946696a..f4244b3 100644 --- a/src/Ui.cpp +++ b/src/Ui.cpp @@ -117,7 +117,7 @@ void Ui::DrawHeaders(unsortedMap& data) // Show Welcome page ImGui::NewLine(); - std::string title = "Welcome to " + Globals::menu_title + " (" + BUILD_NUMBER + ")"; + std::string title = "Welcome to " + Globals::menu_title; Ui::CenterdText(title.c_str()); Ui::CenterdText("Author: Grinch_"); @@ -133,7 +133,7 @@ void Ui::DrawHeaders(unsortedMap& data) ShellExecute(NULL, "open", GITHUB_LINK, NULL, NULL, SW_SHOWNORMAL); ImGui::NewLine(); - ImGui::TextWrapped("If you find bugs or have suggestions, you can let me know at discord :)"); + ImGui::TextWrapped("If you find bugs or have suggestions, you can let me know on discord :)"); ImGui::NewLine(); Ui::CenterdText("Copyright GPLv3 2019-2021"); } diff --git a/src/Vehicle.cpp b/src/Vehicle.cpp index 1ffd0b1..b51300b 100644 --- a/src/Vehicle.cpp +++ b/src/Vehicle.cpp @@ -406,9 +406,8 @@ void Vehicle::SpawnVehicle(std::string &smodel) int imodel = std::stoi(smodel); CVehicle *veh = nullptr; - int interior = 0; - Command(hplayer, &interior); - + int interior = player->m_nAreaCode; + if (Command(imodel)) { CVector pos = player->GetPosition(); @@ -456,9 +455,15 @@ void Vehicle::SpawnVehicle(std::string &smodel) CStreaming::RequestModel(449, PRIORITY_REQUEST); CStreaming::LoadAllRequestedModels(false); - Command(train_id, pos.x, pos.y, pos.z, (CTimer::m_snTimeInMilliseconds % 2 == 0) ? true : false, &hveh); - veh = CPools::GetVehicle(hveh); + CTrain *train = nullptr; + CTrain *carraige = nullptr; + int track = rand() % 2; + int node = CTrain::FindClosestTrackNode(pos,&track); + CTrain::CreateMissionTrain(pos,(rand() % 2) == 1 ? true : false,train_id,&train,&carraige,node,track,false); + + veh = (CVehicle*)train; + hveh = CPools::GetVehicleRef(veh); if (veh->m_pDriver) Command(CPools::GetPedRef(veh->m_pDriver)); @@ -468,7 +473,7 @@ void Vehicle::SpawnVehicle(std::string &smodel) Command(hveh, speed); } Command(hveh); - + Command(hveh); CStreaming::SetModelIsDeletable(590); CStreaming::SetModelIsDeletable(538); CStreaming::SetModelIsDeletable(570); @@ -484,9 +489,9 @@ void Vehicle::SpawnVehicle(std::string &smodel) if (spawner::license_text != "") Command(imodel, spawner::license_text); + int hveh = 0; if (spawner::spawn_inside) { - int hveh = 0; Command(imodel, pos.x, pos.y, pos.z + 4.0f, &hveh); veh = CPools::GetVehicle(hveh); veh->SetHeading(player->GetHeading()); @@ -495,18 +500,17 @@ void Vehicle::SpawnVehicle(std::string &smodel) } else { - int hveh = 0; player->TransformFromObjectSpace(pos, CVector(0, 10, 0)); Command(imodel, pos.x, pos.y, pos.z + 4.0f, &hveh); veh = CPools::GetVehicle(hveh); veh->SetHeading(player->GetHeading()+55.0f); } + veh->m_nAreaCode = interior; + Command(CPools::GetVehicleRef(veh)); CStreaming::SetModelIsDeletable(imodel); } - - if(veh) - Command(CPools::GetVehicleRef(veh), interior); + veh->m_nVehicleFlags.bHasBeenOwnedByPlayer = true; } } @@ -673,7 +677,11 @@ void Vehicle::Main() ImGui::Columns(2, 0, false); - bool state = pVeh->m_nPhysicalFlags.bBulletProof; + bool state = pVeh->m_nVehicleFlags.bAlwaysSkidMarks; + if (Ui::CheckboxWithHint("Always skid marks", &state, nullptr)) + pVeh->m_nVehicleFlags.bAlwaysSkidMarks = state; + + state = pVeh->m_nPhysicalFlags.bBulletProof; if (Ui::CheckboxWithHint("Bullet proof", &state, nullptr, veh_nodmg)) pVeh->m_nPhysicalFlags.bBulletProof = state; @@ -681,6 +689,14 @@ void Vehicle::Main() if (Ui::CheckboxWithHint("Collision proof", &state, nullptr, veh_nodmg)) pVeh->m_nPhysicalFlags.bCollisionProof = state; + state = pVeh->m_nVehicleFlags.bDisableParticles; + if (Ui::CheckboxWithHint("Disable particles", &state, nullptr)) + pVeh->m_nVehicleFlags.bDisableParticles = state; + + state = pVeh->m_nVehicleFlags.bVehicleCanBeTargetted; + if (Ui::CheckboxWithHint("Driver targetable", &state, "Driver can be targeted")) + pVeh->m_nVehicleFlags.bVehicleCanBeTargetted = state; + state = !pVeh->m_nVehicleFlags.bEngineBroken || pVeh->m_nVehicleFlags.bEngineOn; if (Ui::CheckboxWithHint("Engine on", &state, nullptr, !is_driver)) { @@ -691,11 +707,15 @@ void Vehicle::Main() if (Ui::CheckboxWithHint("Explosion proof", &state, nullptr, veh_nodmg)) pVeh->m_nPhysicalFlags.bExplosionProof = state; + ImGui::NextColumn(); + state = pVeh->m_nPhysicalFlags.bFireProof; if (Ui::CheckboxWithHint("Fire proof", &state, nullptr, veh_nodmg)) pVeh->m_nPhysicalFlags.bFireProof = state; - ImGui::NextColumn(); + state = pVeh->m_nVehicleFlags.bVehicleCanBeTargettedByHS; + if (Ui::CheckboxWithHint("HS targetable", &state, "Heat Seaker missile can target this")) + pVeh->m_nVehicleFlags.bVehicleCanBeTargettedByHS = state; state = !pVeh->m_bIsVisible; if (Ui::CheckboxWithHint("Invisible car", &state, nullptr, !is_driver)) @@ -717,7 +737,11 @@ void Vehicle::Main() state = pVeh->m_nPhysicalFlags.bMeeleProof; if (Ui::CheckboxWithHint("Melee proof", &state, nullptr, veh_nodmg)) pVeh->m_nPhysicalFlags.bMeeleProof = state; - + + state = pVeh->m_nVehicleFlags.bTakeLessDamage; + if (Ui::CheckboxWithHint("Take less dmg", &state, nullptr)) + pVeh->m_nVehicleFlags.bTakeLessDamage = state; + ImGui::Columns(1); } diff --git a/src/pch.h b/src/pch.h index f8b4af8..7e501a2 100644 --- a/src/pch.h +++ b/src/pch.h @@ -4,7 +4,7 @@ #define INPUT_BUFFER_SIZE 64 #define SPAWN_PED_LIMIT 20 #define MENU_VERSION "2.5-beta" -#define BUILD_NUMBER "20201220" +#define BUILD_NUMBER "20201225" #define STB_IMAGE_IMPLEMENTATION #define DISCORD_INVITE "https://discord.gg/ZzW7kmf" #define GITHUB_LINK "https://github.com/user-grinch/Cheat-Menu" @@ -23,6 +23,7 @@ #include #include "plugin.h" +#include "CBike.h" #include "CCamera.h" #include "CCheat.h" #include "CClothes.h" @@ -43,6 +44,7 @@ #include "CTheZones.h" #include "CTimer.h" #include "CTimeCycle.h" +#include "CTrain.h" #include "CWeather.h" #include "CWorld.h" #include "extensions/ScriptCommands.h"