diff --git a/.gitignore b/.gitignore index 567609b..dc84959 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ build/ + diff --git a/.vscode/tasks.json b/.vscode/tasks.json index c7f89b2..a1c1a53 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -6,7 +6,7 @@ { "label": "Build Debug", "type": "shell", - "command": "Debug.bat", + "command": "${workspaceFolder}/tools/Debug.bat", "presentation": { "echo": true, "reveal": "always", @@ -23,7 +23,7 @@ { "label": "Build Release", "type": "shell", - "command": "Release.bat", + "command": "${workspaceFolder}/tools/Release.bat", "presentation": { "echo": true, "reveal": "always", diff --git a/resource/CheatMenu/json/versioninfo.json b/resource/CheatMenu/json/versioninfo.json deleted file mode 100644 index 14c15ef..0000000 --- a/resource/CheatMenu/json/versioninfo.json +++ /dev/null @@ -1 +0,0 @@ -[{"name":"2.7","zipball_url":"https://api.github.com/repos/user-grinch/Cheat-Menu/zipball/refs/tags/2.7","tarball_url":"https://api.github.com/repos/user-grinch/Cheat-Menu/tarball/refs/tags/2.7","commit":{"sha":"450f36859ba29d437502df13ddb02a8b36080e52","url":"https://api.github.com/repos/user-grinch/Cheat-Menu/commits/450f36859ba29d437502df13ddb02a8b36080e52"},"node_id":"MDM6UmVmMTkxNzg4MjI2OnJlZnMvdGFncy8yLjc="},{"name":"2.6.2","zipball_url":"https://api.github.com/repos/user-grinch/Cheat-Menu/zipball/refs/tags/2.6.2","tarball_url":"https://api.github.com/repos/user-grinch/Cheat-Menu/tarball/refs/tags/2.6.2","commit":{"sha":"f913a6de4eaed7126b79efff5988d99d33c164d1","url":"https://api.github.com/repos/user-grinch/Cheat-Menu/commits/f913a6de4eaed7126b79efff5988d99d33c164d1"},"node_id":"MDM6UmVmMTkxNzg4MjI2OnJlZnMvdGFncy8yLjYuMg=="},{"name":"2.6.1","zipball_url":"https://api.github.com/repos/user-grinch/Cheat-Menu/zipball/refs/tags/2.6.1","tarball_url":"https://api.github.com/repos/user-grinch/Cheat-Menu/tarball/refs/tags/2.6.1","commit":{"sha":"580e72ec43156a33b61d7b750fb2e8d7adb04f64","url":"https://api.github.com/repos/user-grinch/Cheat-Menu/commits/580e72ec43156a33b61d7b750fb2e8d7adb04f64"},"node_id":"MDM6UmVmMTkxNzg4MjI2OnJlZnMvdGFncy8yLjYuMQ=="},{"name":"2.6","zipball_url":"https://api.github.com/repos/user-grinch/Cheat-Menu/zipball/refs/tags/2.6","tarball_url":"https://api.github.com/repos/user-grinch/Cheat-Menu/tarball/refs/tags/2.6","commit":{"sha":"96673070c64291b0590d2568705dca10b3517d68","url":"https://api.github.com/repos/user-grinch/Cheat-Menu/commits/96673070c64291b0590d2568705dca10b3517d68"},"node_id":"MDM6UmVmMTkxNzg4MjI2OnJlZnMvdGFncy8yLjY="},{"name":"2.5","zipball_url":"https://api.github.com/repos/user-grinch/Cheat-Menu/zipball/refs/tags/2.5","tarball_url":"https://api.github.com/repos/user-grinch/Cheat-Menu/tarball/refs/tags/2.5","commit":{"sha":"91ac2f02fe15a2aa3461a61b9461e56eb7a31439","url":"https://api.github.com/repos/user-grinch/Cheat-Menu/commits/91ac2f02fe15a2aa3461a61b9461e56eb7a31439"},"node_id":"MDM6UmVmMTkxNzg4MjI2OnJlZnMvdGFncy8yLjU="},{"name":"2.2","zipball_url":"https://api.github.com/repos/user-grinch/Cheat-Menu/zipball/refs/tags/2.2","tarball_url":"https://api.github.com/repos/user-grinch/Cheat-Menu/tarball/refs/tags/2.2","commit":{"sha":"c87590ce3e1b2d85394848279fd3ebfcc7c70b23","url":"https://api.github.com/repos/user-grinch/Cheat-Menu/commits/c87590ce3e1b2d85394848279fd3ebfcc7c70b23"},"node_id":"MDM6UmVmMTkxNzg4MjI2OnJlZnMvdGFncy8yLjI="},{"name":"2.1","zipball_url":"https://api.github.com/repos/user-grinch/Cheat-Menu/zipball/refs/tags/2.1","tarball_url":"https://api.github.com/repos/user-grinch/Cheat-Menu/tarball/refs/tags/2.1","commit":{"sha":"a05f0095a7e70a371d93e7c37c540a5b83de4388","url":"https://api.github.com/repos/user-grinch/Cheat-Menu/commits/a05f0095a7e70a371d93e7c37c540a5b83de4388"},"node_id":"MDM6UmVmMTkxNzg4MjI2OnJlZnMvdGFncy8yLjE="},{"name":"2.0","zipball_url":"https://api.github.com/repos/user-grinch/Cheat-Menu/zipball/refs/tags/2.0","tarball_url":"https://api.github.com/repos/user-grinch/Cheat-Menu/tarball/refs/tags/2.0","commit":{"sha":"15a8fa5780b9627b394ac6adab7a8ed3c11f441a","url":"https://api.github.com/repos/user-grinch/Cheat-Menu/commits/15a8fa5780b9627b394ac6adab7a8ed3c11f441a"},"node_id":"MDM6UmVmMTkxNzg4MjI2OnJlZnMvdGFncy8yLjA="},{"name":"1.9","zipball_url":"https://api.github.com/repos/user-grinch/Cheat-Menu/zipball/refs/tags/1.9","tarball_url":"https://api.github.com/repos/user-grinch/Cheat-Menu/tarball/refs/tags/1.9","commit":{"sha":"9eb617ec93569a33fe96a85a277177231165092e","url":"https://api.github.com/repos/user-grinch/Cheat-Menu/commits/9eb617ec93569a33fe96a85a277177231165092e"},"node_id":"MDM6UmVmMTkxNzg4MjI2OnJlZnMvdGFncy8xLjk="},{"name":"1.8","zipball_url":"https://api.github.com/repos/user-grinch/Cheat-Menu/zipball/refs/tags/1.8","tarball_url":"https://api.github.com/repos/user-grinch/Cheat-Menu/tarball/refs/tags/1.8","commit":{"sha":"ddb651ea2497fc1406851304da951ca338310a45","url":"https://api.github.com/repos/user-grinch/Cheat-Menu/commits/ddb651ea2497fc1406851304da951ca338310a45"},"node_id":"MDM6UmVmMTkxNzg4MjI2OnJlZnMvdGFncy8xLjg="},{"name":"1.7","zipball_url":"https://api.github.com/repos/user-grinch/Cheat-Menu/zipball/refs/tags/1.7","tarball_url":"https://api.github.com/repos/user-grinch/Cheat-Menu/tarball/refs/tags/1.7","commit":{"sha":"23b17d1d66000b547f34bb2d4709a04f8b818e2a","url":"https://api.github.com/repos/user-grinch/Cheat-Menu/commits/23b17d1d66000b547f34bb2d4709a04f8b818e2a"},"node_id":"MDM6UmVmMTkxNzg4MjI2OnJlZnMvdGFncy8xLjc="},{"name":"1.6","zipball_url":"https://api.github.com/repos/user-grinch/Cheat-Menu/zipball/refs/tags/1.6","tarball_url":"https://api.github.com/repos/user-grinch/Cheat-Menu/tarball/refs/tags/1.6","commit":{"sha":"23b17d1d66000b547f34bb2d4709a04f8b818e2a","url":"https://api.github.com/repos/user-grinch/Cheat-Menu/commits/23b17d1d66000b547f34bb2d4709a04f8b818e2a"},"node_id":"MDM6UmVmMTkxNzg4MjI2OnJlZnMvdGFncy8xLjY="},{"name":"1.5","zipball_url":"https://api.github.com/repos/user-grinch/Cheat-Menu/zipball/refs/tags/1.5","tarball_url":"https://api.github.com/repos/user-grinch/Cheat-Menu/tarball/refs/tags/1.5","commit":{"sha":"db12c60ae8dd97c06d7037a9264d60184d248949","url":"https://api.github.com/repos/user-grinch/Cheat-Menu/commits/db12c60ae8dd97c06d7037a9264d60184d248949"},"node_id":"MDM6UmVmMTkxNzg4MjI2OnJlZnMvdGFncy8xLjU="}] \ No newline at end of file diff --git a/src/CheatMenu.cpp b/src/CheatMenu.cpp index 3e5e967..4157e4a 100644 --- a/src/CheatMenu.cpp +++ b/src/CheatMenu.cpp @@ -55,7 +55,7 @@ void CheatMenu::DrawWindow() CheatMenu::CheatMenu() { ApplyStyle(); - window_callback = std::bind(&DrawWindow); + windowCallback = std::bind(&DrawWindow); // Load menu settings Globals::m_HeaderId = config.GetValue("window.id", std::string("")); diff --git a/src/Game.cpp b/src/Game.cpp index a7625fb..4249337 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -91,10 +91,14 @@ Game::Game() Command(3095, pos.x, pos.y, waterHeight, &m_nSolidWaterObj); Command(m_nSolidWaterObj, false); if (pos.z < (waterHeight + 1)) + { pPlayer->SetPosn(pos.x, pos.y, waterHeight + 1); + } } else + { Command(m_nSolidWaterObj, pos.x, pos.y, waterHeight); + } } else { @@ -216,10 +220,14 @@ void Game::FreeCam() m_Freecam::m_fTotalMouse.y = m_Freecam::m_fTotalMouse.y + m_Freecam::m_fMouse.y / 3; if (m_Freecam::m_fTotalMouse.x > 150) + { m_Freecam::m_fTotalMouse.y = 150; + } if (m_Freecam::m_fTotalMouse.y < -150) + { m_Freecam::m_fTotalMouse.y = -150; + } if (Ui::HotKeyPressed(Menu::m_HotKeys::freeCamTeleportPlayer)) { @@ -236,15 +244,21 @@ void Game::FreeCam() } if (KeyPressed(VK_RCONTROL)) + { deltaSpeed /= 2; + } if (KeyPressed(VK_RSHIFT)) + { deltaSpeed *= 2; + } if (KeyPressed(VK_KEY_I) || KeyPressed(VK_KEY_K)) { if (KeyPressed(VK_KEY_K)) + { deltaSpeed *= -1; + } float angle; Command(m_Freecam::m_nPed, &angle); @@ -256,7 +270,9 @@ void Game::FreeCam() if (KeyPressed(VK_KEY_J) || KeyPressed(VK_KEY_L)) { if (KeyPressed(VK_KEY_J)) + { deltaSpeed *= -1; + } float angle; Command(m_Freecam::m_nPed, &angle); @@ -269,7 +285,9 @@ void Game::FreeCam() if (CPad::NewMouseControllerState.wheelUp) { if (m_Freecam::m_fFOV > 10.0f) + { m_Freecam::m_fFOV -= 2.0f * deltaSpeed; + } TheCamera.LerpFOV(TheCamera.FindCamFOV(), m_Freecam::m_fFOV, 250, true); Command(true); @@ -278,7 +296,9 @@ void Game::FreeCam() if (CPad::NewMouseControllerState.wheelDown) { if (m_Freecam::m_fFOV < 115.0f) + { m_Freecam::m_fFOV += 2.0f * deltaSpeed; + } TheCamera.LerpFOV(TheCamera.FindCamFOV(), m_Freecam::m_fFOV, 250, true); Command(true); @@ -341,9 +361,13 @@ void Game::Draw() if (ImGui::Checkbox("Disable F1 & F3 replay", &m_bDisableReplay)) { if (m_bDisableReplay) + { patch::SetInt(0x460500, 0xC3, false); + } else + { patch::SetInt(0x460500, 0xBD844BB, false); + } } Ui::CheckboxAddress("Faster clock", 0x96913B); @@ -352,9 +376,13 @@ void Game::Draw() of LS without completing missions")) { if (m_bForbiddenArea) + { patch::Set(0x441770, 0x83, false); + } else + { patch::Set(0x441770, 0xC3, false); + } } Ui::CheckboxAddress("Free pay n spray", 0x96C009); @@ -421,7 +449,10 @@ Lowers armour, health, stamina etc.")) { int day = CClock::CurrentDay - 1; if (Ui::ListBox("Select day", m_DayNames, day)) + { CClock::CurrentDay = day + 1; + } + ImGui::Spacing(); ImGui::Separator(); } @@ -483,26 +514,38 @@ Lowers armour, health, stamina etc.")) { using func = void(void); if (ImGui::Button("Foggy", Ui::GetSize(3))) + { ((func*)0x438F80)(); + } ImGui::SameLine(); if (ImGui::Button("Overcast", Ui::GetSize(3))) + { ((func*)0x438F60)(); + } ImGui::SameLine(); if (ImGui::Button("Rainy", Ui::GetSize(3))) + { ((func*)0x438F70)(); + } if (ImGui::Button("Sandstorm", Ui::GetSize(3))) + { ((func*)0x439590)(); + } ImGui::SameLine(); if (ImGui::Button("Thunderstorm", Ui::GetSize(3))) + { ((func*)0x439570)(); + } ImGui::SameLine(); if (ImGui::Button("Very sunny", Ui::GetSize(3))) + { ((func*)0x438F50)(); + } ImGui::Spacing(); ImGui::Separator(); @@ -560,9 +603,11 @@ It's recommanded not to save after using the mission loader. Use it at your own { for (auto _data : root.value().items()) { - auto name = _data.value().get(); + std::string name = _data.value().get(); if (m_StatData.m_Filter.PassFilter(name.c_str())) + { Ui::EditStat(name.c_str(), std::stoi(_data.key())); + } } } } @@ -586,12 +631,14 @@ It's recommanded not to save after using the mission loader. Use it at your own ImGui::Separator(); if (ImGui::BeginChild("Cheats list")) { - for (auto element : m_RandomCheats::m_EnabledCheats) + for (std::string* element : m_RandomCheats::m_EnabledCheats) { bool selected = (element[1] == "true") ? true : false; if (ImGui::MenuItem(element[0].c_str(), nullptr, selected)) + { element[1] = selected ? "false" : "true"; + } } ImGui::EndChild(); } diff --git a/src/Hook.cpp b/src/Hook.cpp index 2f5450a..e5eddae 100644 --- a/src/Hook.cpp +++ b/src/Hook.cpp @@ -37,7 +37,9 @@ HRESULT Hook::Reset(IDirect3DDevice9* pDevice, D3DPRESENT_PARAMETERS* pPresentat void Hook::RenderFrame(void* ptr) { if (!ImGui::GetCurrentContext()) + { return; + } ImGuiIO& io = ImGui::GetIO(); @@ -49,15 +51,19 @@ void Hook::RenderFrame(void* ptr) ImVec2 size(screen::GetScreenWidth(), screen::GetScreenHeight()); if (Globals::m_fScreenSize.x != size.x && Globals::m_fScreenSize.y != size.y) { - int font_size = static_cast(size.y / 54.85f); // manually tested + int fontSize = static_cast(size.y / 54.85f); // manually tested - io.FontDefault = io.Fonts->AddFontFromFileTTF("C:/Windows/Fonts/trebucbd.ttf", font_size); + io.FontDefault = io.Fonts->AddFontFromFileTTF("C:/Windows/Fonts/trebucbd.ttf", fontSize); io.Fonts->Build(); if (Globals::renderer == Render_DirectX9) + { ImGui_ImplDX9_InvalidateDeviceObjects(); + } else + { ImGui_ImplDX11_InvalidateDeviceObjects(); + } if (Globals::m_fScreenSize.x != -1 && Globals::m_fScreenSize.y != -1) { @@ -66,36 +72,46 @@ void Hook::RenderFrame(void* ptr) } ImGuiStyle* style = &ImGui::GetStyle(); - float scale_x = size.x / 1366.0f; - float scale_y = size.y / 768.0f; + float scaleX = size.x / 1366.0f; + float scaleY = size.y / 768.0f; - style->FramePadding = ImVec2(5 * scale_x, 3 * scale_y); - style->ItemSpacing = ImVec2(8 * scale_x, 4 * scale_y); - style->ScrollbarSize = 12 * scale_x; - style->IndentSpacing = 20 * scale_x; - style->ItemInnerSpacing = ImVec2(4 * scale_x, 4 * scale_y); + style->FramePadding = ImVec2(5 * scaleX, 3 * scaleY); + style->ItemSpacing = ImVec2(8 * scaleX, 4 * scaleY); + style->ScrollbarSize = 12 * scaleX; + style->IndentSpacing = 20 * scaleX; + style->ItemInnerSpacing = ImVec2(4 * scaleX, 4 * scaleY); Globals::m_fScreenSize = size; } ImGui_ImplWin32_NewFrame(); if (Globals::renderer == Render_DirectX9) + { ImGui_ImplDX9_NewFrame(); + } else + { ImGui_ImplDX11_NewFrame(); + } ImGui::NewFrame(); - if (window_callback != nullptr) - window_callback(); + if (windowCallback != nullptr) + { + windowCallback(); + } ImGui::EndFrame(); ImGui::Render(); if (Globals::renderer == Render_DirectX9) + { ImGui_ImplDX9_RenderDrawData(ImGui::GetDrawData()); + } else + { ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData()); + } } else { @@ -240,10 +256,14 @@ static int _cdecl _GetMouseState(Mouse* pMouse) GetCursorPos(&Point); if (mouseInfo.x >= 0) + { pMouse->x = int(Point.x - mouseInfo.x); + } if (mouseInfo.y >= 0) + { pMouse->y = int(Point.y - mouseInfo.y); + } mouseInfo.wheelDelta = 0; diff --git a/src/Hook.h b/src/Hook.h index 44b7fc6..ced659e 100644 --- a/src/Hook.h +++ b/src/Hook.h @@ -25,7 +25,7 @@ private: public: inline static bool m_bShowMouse = false; - inline static std::function window_callback = nullptr; + inline static std::function windowCallback = nullptr; static void ApplyMouseFix(); Hook(); diff --git a/src/Player.cpp b/src/Player.cpp index 812c2e8..f57f703 100644 --- a/src/Player.cpp +++ b/src/Player.cpp @@ -407,23 +407,17 @@ void Player::Draw() { if (ImGui::BeginTabItem("Clothes")) { + static int bClothOption = 0; + ImGui::RadioButton("Add", &bClothOption, 0); + ImGui::SameLine(); + ImGui::RadioButton("Remove", &bClothOption, 1); ImGui::Spacing(); if (pPlayer->m_nModelIndex == 0) { - if (ImGui::Button("Remove clothes", ImVec2(Ui::GetSize()))) + if (bClothOption == 0) { - CPlayerPed* player = FindPlayerPed(); - - int temp = 0; - for (uint i = 0; i < 18; i++) - player->m_pPlayerData->m_pPedClothesDesc->SetTextureAndModel(temp, temp, i); - - CClothes::RebuildPlayer(player, false); - } - ImGui::Spacing(); - - Ui::DrawImages(m_ClothData.m_ImagesList, ImVec2(70, 100), m_ClothData.m_Categories, m_ClothData.m_Selected, + Ui::DrawImages(m_ClothData.m_ImagesList, ImVec2(70, 100), m_ClothData.m_Categories, m_ClothData.m_Selected, m_ClothData.m_Filter, ChangePlayerCloth, nullptr, [](std::string str) { @@ -435,6 +429,40 @@ void Player::Draw() return temp; }, nullptr, cloth_category, sizeof(cloth_category)/ sizeof(const char*)); + } + else + { + size_t count = 0; + + if(ImGui::Button("Remove all", ImVec2(Ui::GetSize(2)))) + { + CPlayerPed* player = FindPlayerPed(); + for (uint i = 0; i < 18; i++) + { + player->m_pPlayerData->m_pPedClothesDesc->SetTextureAndModel(0u, 0u, i); + } + CClothes::RebuildPlayer(player, false); + } + ImGui::SameLine(); + for (const char* clothName : cloth_category) + { + if(ImGui::Button(clothName, ImVec2(Ui::GetSize(2)))) + { + CPlayerPed* player = FindPlayerPed(); + player->m_pPlayerData->m_pPedClothesDesc->SetTextureAndModel(0u, 0u, count); + CClothes::RebuildPlayer(player, false); + } + + if (count %2 != 0) + { + ImGui::SameLine(); + } + ++count; + } + + ImGui::Spacing(); + ImGui::TextWrapped("If CJ is wearing a full suit, click 'Extras/ Remove all' to remove it."); + } } else { diff --git a/src/Weapon.cpp b/src/Weapon.cpp index 581453b..7c931d2 100644 --- a/src/Weapon.cpp +++ b/src/Weapon.cpp @@ -20,41 +20,55 @@ Weapon::Weapon() if (CPad::NewMouseControllerState.X == 0 && CPad::NewMouseControllerState.Y == 0) { if (KeyPressed(2)) + { CCamera::m_bUseMouse3rdPerson = false; + } } else + { CCamera::m_bUseMouse3rdPerson = true; + } } uchar slot = player->m_nActiveWeaponSlot; if (m_nCurrentWeaponSlot != slot) { - auto weapon_type = player->m_aWeapons[slot].m_nType; - CWeaponInfo* pweapon_info = CWeaponInfo::GetWeaponInfo(weapon_type, player->GetWeaponSkill(weapon_type)); + eWeaponType weaponType = player->m_aWeapons[slot].m_nType; + CWeaponInfo* pWeaponInfo = CWeaponInfo::GetWeaponInfo(weaponType, player->GetWeaponSkill(weaponType)); if (m_bHugeDamage) - pweapon_info->m_nDamage = 1000; + { + pWeaponInfo->m_nDamage = 1000; + } if (m_bLongRange) { - pweapon_info->m_fTargetRange = 1000.0f; - pweapon_info->m_fWeaponRange = 1000.0f; - pweapon_info->m_fAccuracy = 1.0f; - pweapon_info->m_nFlags.bReload2Start = true; + pWeaponInfo->m_fTargetRange = 1000.0f; + pWeaponInfo->m_fWeaponRange = 1000.0f; + pWeaponInfo->m_fAccuracy = 1.0f; + pWeaponInfo->m_nFlags.bReload2Start = true; } - if (m_bRapidFire && weapon_type != WEAPON_MINIGUN) // mingun doesn't work with rapidfire - pweapon_info->m_nFlags.bContinuosFire = true; + if (m_bRapidFire && weaponType != WEAPON_MINIGUN) // mingun doesn't work with rapidfire + { + pWeaponInfo->m_nFlags.bContinuosFire = true; + } - if (m_bDualWeild && (weapon_type == WEAPON_PISTOL || weapon_type == WEAPON_MICRO_UZI || weapon_type == - WEAPON_TEC9 || weapon_type == WEAPON_SAWNOFF)) - pweapon_info->m_nFlags.bTwinPistol = true; + if (m_bDualWeild && (weaponType == WEAPON_PISTOL || weaponType == WEAPON_MICRO_UZI || weaponType == + WEAPON_TEC9 || weaponType == WEAPON_SAWNOFF)) + { + pWeaponInfo->m_nFlags.bTwinPistol = true; + } if (m_bMoveAim) - pweapon_info->m_nFlags.bMoveAim = true; + { + pWeaponInfo->m_nFlags.bMoveAim = true; + } if (m_bMoveFire) - pweapon_info->m_nFlags.bMoveFire = true; + { + pWeaponInfo->m_nFlags.bMoveFire = true; + } m_nCurrentWeaponSlot = slot; } @@ -75,7 +89,9 @@ void Weapon::GiveWeaponToPlayer(std::string& weapon_type) int hplayer = CPools::GetPedRef(player); if (weapon_type == "-1") // Jetpack + { Command(hplayer); + } else { int iweapon_type = std::stoi(weapon_type); @@ -86,14 +102,17 @@ void Weapon::GiveWeaponToPlayer(std::string& weapon_type) CStreaming::RequestModel(model, PRIORITY_REQUEST); if (model == 363) // remote bomb + { CStreaming::RequestModel(364, PRIORITY_REQUEST); // detonator + } CStreaming::LoadAllRequestedModels(false); - Command(hplayer, iweapon_type, m_nAmmoCount); if (model == 363) // remote bomb + { Command(364); // detonator + } Command(model); } @@ -101,33 +120,37 @@ void Weapon::GiveWeaponToPlayer(std::string& weapon_type) void Weapon::Draw() { - CPlayerPed* player = FindPlayerPed(); - uint hplayer = CPools::GetPedRef(player); + CPlayerPed* pPlayer = FindPlayerPed(); + uint hplayer = CPools::GetPedRef(pPlayer); ImGui::Spacing(); if (ImGui::Button("Drop weapon", Ui::GetSize(3))) { float x, y, z; Command(hplayer, 0.0, 3.0, 0.0, &x, &y, &z); - auto type = player->m_aWeapons[player->m_nActiveWeaponSlot].m_nType; + eWeaponType weaponType = pPlayer->m_aWeapons[pPlayer->m_nActiveWeaponSlot].m_nType; - if (type) + if (weaponType) { int model = 0, pickup = 0; - Command(type, &model); + Command(weaponType, &model); Command(model, 3, 999, x, y, z, &pickup); - Command(hplayer, type); + Command(hplayer, weaponType); } } ImGui::SameLine(); if (ImGui::Button("Remove all", Ui::GetSize(3))) + { Command(hplayer); + } ImGui::SameLine(); if (ImGui::Button("Remove current", Ui::GetSize(3))) - Command(hplayer, player->m_aWeapons[player->m_nActiveWeaponSlot].m_nType); + { + Command(hplayer, pPlayer->m_aWeapons[pPlayer->m_nActiveWeaponSlot].m_nType); + } ImGui::Spacing(); @@ -145,12 +168,16 @@ void Weapon::Draw() "Dual wield pistol, shawoff, uzi, tec9\n(Other weapons don't work)")) { if (!m_bDualWeild) + { CWeaponInfo::LoadWeaponData(); + } } if (Ui::CheckboxWithHint("Huge damage", &m_bHugeDamage)) { if (!m_bHugeDamage) + { CWeaponInfo::LoadWeaponData(); + } } if (Ui::CheckboxWithHint("Fast reload", &m_bFastReload)) Command(hplayer, m_bFastReload); @@ -162,22 +189,30 @@ void Weapon::Draw() if (Ui::CheckboxWithHint("Long range", &m_bLongRange)) { if (!m_bLongRange) + { CWeaponInfo::LoadWeaponData(); + } } if (Ui::CheckboxWithHint("Move when aiming", &m_bMoveAim)) { if (!m_bMoveAim) + { CWeaponInfo::LoadWeaponData(); + } } if (Ui::CheckboxWithHint("Move when firing", &m_bMoveFire)) { if (!m_bMoveFire) + { CWeaponInfo::LoadWeaponData(); + } } if (Ui::CheckboxWithHint("Rapid fire", &m_bRapidFire)) { if (!m_bRapidFire) + { CWeaponInfo::LoadWeaponData(); + } } ImGui::Columns(1, 0, false); ImGui::EndChild(); diff --git a/Debug.bat b/tools/Debug.bat similarity index 89% rename from Debug.bat rename to tools/Debug.bat index 3f0bc32..10ec431 100644 --- a/Debug.bat +++ b/tools/Debug.bat @@ -1,6 +1,7 @@ @echo off +cd tools premake5.exe vs2019 -cd build +cd ../build call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\VsDevCmd.bat" MsBuild CheatMenu.sln /property:Configuration=Debug cd .. diff --git a/Release.bat b/tools/Release.bat similarity index 89% rename from Release.bat rename to tools/Release.bat index ae28769..52620b1 100644 --- a/Release.bat +++ b/tools/Release.bat @@ -1,6 +1,7 @@ @echo off +cd tools premake5.exe vs2019 -cd build +cd ../build call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\VsDevCmd.bat" MsBuild CheatMenu.sln /property:Configuration=Release cd .. diff --git a/premake5.exe b/tools/premake5.exe similarity index 100% rename from premake5.exe rename to tools/premake5.exe diff --git a/premake5.lua b/tools/premake5.lua similarity index 87% rename from premake5.lua rename to tools/premake5.lua index e0f2d3b..540992b 100644 --- a/premake5.lua +++ b/tools/premake5.lua @@ -24,17 +24,17 @@ workspace "CheatMenu" cppdialect "C++20" characterset "MBCS" staticruntime "On" - location "build" + location "../build" project "Depend" kind "StaticLib" - targetdir "build/bin" + targetdir "../build/bin" files { - "depned/**.h", - "depend/**.hpp", - "depend/**.c", - "depend/**.cpp" + "../depned/**.h", + "../depend/**.hpp", + "../depend/**.c", + "../depend/**.cpp" } libdirs (PSDK_DIR .. "/output/lib") @@ -52,9 +52,9 @@ project "CheatMenu" targetextension ".asi" files { - "src/**.h", - "src/**.hpp", - "src/**.cpp" + "../src/**.h", + "../src/**.hpp", + "../src/**.cpp" } includedirs { PSDK_DIR .. "/plugin_sa/", @@ -75,7 +75,7 @@ project "CheatMenu" } pchheader "pch.h" - pchsource "src/pch.cpp" + pchsource "../src/pch.cpp" filter "configurations:Debug" symbols "On"