Push teleport, menu & player (vc)

This commit is contained in:
Grinch_ 2021-08-06 21:53:18 +06:00
parent 880ceba2c4
commit 0a15765771
26 changed files with 516 additions and 296 deletions

View File

@ -0,0 +1,48 @@
{
"Special" :
{
"Alex Shrub" : "IGalscb",
"Lance 1" : "IGbuddy",
"Lance Cop" : "IGBudy2",
"Lance Beaten Up" : "IGBudy3",
"Candy Suxxx" : "IGCandy",
"Colonel Cortez" : "IGColon",
"Ricardo Diaz" : "IGDiaz",
"Dick (Lovefist)" : "IGDick",
"Gonzalez" : "IGGonz",
"Hilary" : "IGHlary",
"Hilary (Bank Mission)" : "IGHlry2",
"Jezz Torrent" : "IGJezz",
"Ken Rosenberg" : "IGKen",
"Mercedes" : "IGMerc",
"Mercedes (purple dress)" : "IGMerc2",
"Cam Jones" : "IGmike",
"Cam Jones (Bank Mission)" : "IGMike2",
"Percy (Lovefist)" : "IGPercy",
"Phil Cassidy" : "IGPhil",
"Phil (Injured)" : "IGphil2",
"Phil (Bank Mission)" : "IGPhil3",
"Sonny Forelli" : "IGSonny"
},
"Misc" :
{
"Fsfa" : "FSFA",
"Courier" : "COURIER",
"Chef" : "CHEF",
"Sgc" : "SGC",
"Psycho" : "PSYCHO",
"Striper" : "STRIPA"
},
"Player" :
{
"Tommy Default" : "Player",
"Tommy Suit Plain" : "Player2",
"Tommy Worker" : "Player3",
"Tommy Golfer" : "Player4",
"Tommy Cuban" : "Player5",
"Tommy Cop" : "Player6",
"Tommy Bank" : "Player7",
"Tommy Simple" : "Player8",
"Tommy Suit Stripe" : "Player9"
}
}

View File

@ -18,7 +18,7 @@ private:
inline static bool m_Loop;
inline static bool m_bSecondary;
inline static std::string m_nWalkingStyle = "default";
inline static std::vector<std::string> m_FightingStyleList = {"Default", "Boxing", "Kung fu", "Kick Boxing", "Punch Kick"};
inline static std::vector<std::string> m_FightingStyleList = { "Default", "Boxing", "Kung fu", "Kick Boxing", "Punch Kick" };
inline static std::vector<std::string> m_WalkingStyleList =
{
"default", "man", "shuffle", "oldman", "gang1", "gang2", "oldfatman",

View File

@ -9,11 +9,11 @@ void CheatMenu::DrawWindow()
ImGuiIO& io = ImGui::GetIO();
static bool bRunning = true;
#ifdef GTASA
#ifdef GTASA
if (FrontEndMenuManager.m_bMenuActive)
#elif GTAVC
#elif GTAVC
if (FrontendMenuManager.m_bMenuVisible)
#endif
#endif
{
if (bRunning)
{
@ -25,11 +25,11 @@ void CheatMenu::DrawWindow()
else
{
bRunning = true;
#ifdef GTASA
#ifdef GTASA
if (Globals::m_bShowMenu || m_Commands::m_bShowMenu)
#elif GTAVC
#elif GTAVC
if (Globals::m_bShowMenu)
#endif
#endif
{
if (Globals::m_bShowMenu)
{
@ -53,12 +53,12 @@ void CheatMenu::DrawWindow()
ImGui::End();
}
}
#ifdef GTASA
#ifdef GTASA
else
{
DrawShortcutsWindow();
}
#endif
#endif
}
}
DrawOverlay();
@ -78,11 +78,11 @@ CheatMenu::CheatMenu()
Events::processScriptsEvent += []()
{
if (Globals::m_bInit &&
#ifdef GTASA
#ifdef GTASA
!FrontEndMenuManager.m_bMenuActive
#elif GTAVC
#elif GTAVC
!FrontendMenuManager.m_bMenuVisible
#endif
#endif
)
{
if (Ui::HotKeyPressed(Menu::m_HotKeys::menuOpen))
@ -196,11 +196,11 @@ void MenuThread(void* param)
}
static bool bGameInit = false;
#ifdef GTASA
#ifdef GTASA
Hook::ApplyMouseFix();
#endif
#endif
// Wait till the game is initialized
// Wait till the game is initialized
Events::initRwEvent += []
{
bGameInit = true;
@ -244,7 +244,7 @@ BOOL WINAPI DllMain(HINSTANCE hDllHandle, DWORD nReason, LPVOID Reserved)
if (nReason == DLL_PROCESS_ATTACH)
{
uint gameVersion = GetGameVersion();
#ifdef GTASA
#ifdef GTASA
if (gameVersion == GAME_10US_HOODLUM || gameVersion == GAME_10US_COMPACT)
{
CreateThread(nullptr, NULL, (LPTHREAD_START_ROUTINE)&MenuThread, nullptr, NULL, nullptr);
@ -253,7 +253,7 @@ BOOL WINAPI DllMain(HINSTANCE hDllHandle, DWORD nReason, LPVOID Reserved)
{
MessageBox(HWND_DESKTOP, "Unknown game version. GTA SA v1.0 US is required.", "CheatMenu", MB_ICONERROR);
}
#elif GTAVC
#elif GTAVC
if (gameVersion == GAME_10EN)
{
CreateThread(nullptr, NULL, (LPTHREAD_START_ROUTINE)&MenuThread, nullptr, NULL, nullptr);
@ -262,7 +262,7 @@ BOOL WINAPI DllMain(HINSTANCE hDllHandle, DWORD nReason, LPVOID Reserved)
{
MessageBox(HWND_DESKTOP, "Unknown game version. GTA VC v1.0 EN is required.", "CheatMenu", MB_ICONERROR);
}
#endif
#endif
}
return TRUE;

View File

@ -12,35 +12,35 @@
#include "Hook.h"
#include "Menu.h"
#include "Teleport.h"
#include "Player.h"
#ifdef GTASA
#include "Animation.h"
#include "Game.h"
#include "Ped.h"
#include "Player.h"
#include "Vehicle.h"
#include "Visual.h"
#include "Weapon.h"
class CheatMenu : Hook, Animation, Game, Menu, Ped, Player, Teleport, Vehicle, Visual, Weapon
#include "Animation.h"
#include "Game.h"
#include "Ped.h"
#include "Vehicle.h"
#include "Visual.h"
#include "Weapon.h"
class CheatMenu : Hook, Animation, Game, Menu, Ped, Player, Teleport, Vehicle, Visual, Weapon
#elif defined(GTAVC)
class CheatMenu : Hook, Menu, Teleport
class CheatMenu : Hook, Menu, Player, Teleport
#endif
{
private:
#ifdef GTASA
#ifdef GTASA
inline static CallbackTable header
{
{"Teleport", &Teleport::Draw}, {"Player", &Player::Draw}, {"Ped", &Ped::Draw},
{"Animation", &Animation::Draw}, {"Vehicle", &Vehicle::Draw}, {"Weapon", &Weapon::Draw},
{"Game", &Game::Draw}, {"Visual", &Visual::Draw}, {"Menu", &Menu::Draw}
};
#elif GTAVC
#elif GTAVC
inline static CallbackTable header
{
{"Teleport", &Teleport::Draw}, {"Menu", &Menu::Draw}
{"Teleport", &Teleport::Draw}, {"Player", &Player::Draw}, {"Menu", &Menu::Draw}
};
#endif
#endif
static void ApplyStyle();
static void DrawWindow();

View File

@ -329,7 +329,7 @@ void Game::Draw()
CPlayerPed* pPlayer = FindPlayerPed();
int hplayer = CPools::GetPedRef(pPlayer);
if (ImGui::Button("Save game (might cause game bugs)",Ui::GetSize()))
if (ImGui::Button("Save game (might cause game bugs)", Ui::GetSize()))
{
FrontEndMenuManager.m_bActivateMenuNextFrame = true;
bSaveGameFlag = true;

View File

@ -2,7 +2,7 @@
class Game
{
public:
inline static SSearchData m_MissionData{"mission"};
inline static SSearchData m_MissionData{ "mission" };
inline static std::vector<std::string> m_DayNames =
{
"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"

View File

@ -9,9 +9,9 @@ LRESULT Hook::WndProc(const HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (ImGui::GetIO().WantTextInput)
{
#ifdef GTASA
#ifdef GTASA
Call<0x53F1E0>(); // CPad::ClearKeyboardHistory
#endif
#endif
return 1;
}
@ -113,10 +113,10 @@ void Hook::RenderFrame(void* ptr)
ImGui_ImplWin32_Init(RsGlobal.ps->window);
#ifdef GTASA
// shift trigger fix
#ifdef GTASA
// shift trigger fix
patch::Nop(0x00531155, 5);
#endif
#endif
if (Globals::renderer == Render_DirectX9)
{
@ -165,9 +165,9 @@ void Hook::ShowMouse(bool state)
ImGui::GetIO().MouseDrawCursor = state;
#ifdef GTASA
#ifdef GTASA
Hook::ApplyMouseFix(); // Reapply the patches
#elif GTAVC
#elif GTAVC
if (m_bShowMouse)
{
patch::SetUChar(0x6020A0, 0xC3); // psSetMousePos
@ -178,7 +178,7 @@ void Hook::ShowMouse(bool state)
patch::SetUChar(0x6020A0, 0x53);
patch::SetRaw(0x4AB6CA, (char*)"\xE8\x51\x21\x00\x00", 5);
}
#endif
#endif
CPad::NewMouseControllerState.X = 0;
CPad::NewMouseControllerState.Y = 0;

View File

@ -27,9 +27,9 @@ public:
inline static bool m_bShowMouse = false;
inline static std::function<void()> windowCallback = nullptr;
#ifdef GTASA
#ifdef GTASA
static void ApplyMouseFix();
#endif
#endif
Hook();
~Hook();

View File

@ -1,6 +1,6 @@
#pragma once
#define MENU_NAME "Cheat Menu"
#define MENU_VERSION_NUMBER "2.8"
#define MENU_VERSION_NUMBER "2.9"
#define MENU_VERSION MENU_VERSION_NUMBER"-beta"
#define BUILD_NUMBER "20210801"
#define BUILD_NUMBER "20210806"
#define MENU_TITLE MENU_NAME " v" MENU_VERSION "(" BUILD_NUMBER ")"

View File

@ -1,10 +1,12 @@
#include "pch.h"
#include "Player.h"
#include "Ped.h"
#include "Menu.h"
#include "Ui.h"
#include "Util.h"
#ifdef GTASA
#include "Ped.h"
// hardcoded cloth category names
const char* cloth_category[18] =
{
@ -35,17 +37,23 @@ inline static void PlayerModelBrokenFix()
if (pPlayer->m_nModelIndex == 0)
Call<0x5A81E0>(0, pPlayer->m_pPlayerData->m_pPedClothesDesc, 0xBC1C78, false);
}
#elif GTAVC
inline static SSearchData tempPedData{ "peds" };
#endif
Player::Player()
{
// Fix player model being broken after rebuild
#ifdef GTASA
// Fix player model being broken after rebuild
patch::RedirectCall(0x5A834D, &PlayerModelBrokenFix);
#endif
m_bAimSkinChanger = config.GetValue("aim_skin_changer", false);
// Custom skins setup
if (GetModuleHandle("modloader.asi"))
{
#ifdef GTASA
if (fs::is_directory(m_CustomSkins::m_Path))
{
for (auto& p : fs::recursive_directory_iterator(m_CustomSkins::m_Path))
@ -61,7 +69,11 @@ Player::Player()
}
}
}
else fs::create_directory(m_CustomSkins::m_Path);
else
{
fs::create_directory(m_CustomSkins::m_Path);
}
#endif
m_bModloaderInstalled = true;
}
@ -69,17 +81,25 @@ Player::Player()
Events::processScriptsEvent += []
{
uint timer = CTimer::m_snTimeInMilliseconds;
static CPlayerPed* player = FindPlayerPed();
CPlayerPed* player = FindPlayerPed();
int hplayer = CPools::GetPedRef(player);
if (!m_bImagesLoaded)
{
#ifdef GTASA
Util::LoadTextureDirectory(m_ClothData, PLUGIN_PATH((char*)"CheatMenu\\clothes.txd"), true);
#elif GTAVC
tempPedData.m_Json.LoadData(tempPedData.m_Categories, tempPedData.m_Selected);
#endif
m_bImagesLoaded = true;
}
if (m_KeepPosition::m_bEnabled)
{
if (!player->IsAlive())
if (Command<Commands::IS_CHAR_DEAD>(hplayer))
{
m_KeepPosition::m_fPos = player->GetPosition();
}
@ -90,7 +110,8 @@ Player::Player()
if (m_KeepPosition::m_fPos.x != 0 && m_KeepPosition::m_fPos.x != cur_pos.x
&& m_KeepPosition::m_fPos.y != 0 && m_KeepPosition::m_fPos.y != cur_pos.y)
{
player->Teleport(m_KeepPosition::m_fPos, false);
BY_GAME(player->Teleport(m_KeepPosition::m_fPos, false)
, player->Teleport(m_KeepPosition::m_fPos));
m_KeepPosition::m_fPos = CVector(0, 0, 0);
}
}
@ -98,36 +119,53 @@ Player::Player()
if (m_bGodMode)
{
#ifdef GTASA
patch::Set<bool>(0x96916D, 1, false);
player->m_nPhysicalFlags.bBulletProof = 1;
player->m_nPhysicalFlags.bCollisionProof = 1;
player->m_nPhysicalFlags.bExplosionProof = 1;
player->m_nPhysicalFlags.bFireProof = 1;
player->m_nPhysicalFlags.bMeeleProof = 1;
#elif GTAVC
player->m_nFlags.bBulletProof = 1;
player->m_nFlags.bCollisionProof = 1;
player->m_nFlags.bExplosionProof = 1;
player->m_nFlags.bFireProof = 1;
player->m_nFlags.bMeleeProof = 1;
#endif
}
#ifdef GTASA
if (m_bAimSkinChanger && Ui::HotKeyPressed(Menu::m_HotKeys::aimSkinChanger))
{
CPed* target_ped = player->m_pPlayerTargettedPed;
if (target_ped)
CPed* targetPed = player->m_pPlayerTargettedPed;
if (targetPed)
{
player->SetModelIndex(target_ped->m_nModelIndex);
player->SetModelIndex(targetPed->m_nModelIndex);
Util::ClearCharTasksVehCheck(player);
}
}
#endif
if (Ui::HotKeyPressed(Menu::m_HotKeys::godMode))
{
if (m_bGodMode)
{
SetHelpMessage("God mode disabled", false, false, false);
#ifdef GTASA
patch::Set<bool>(0x96916D, m_bGodMode, false);
player->m_nPhysicalFlags.bBulletProof = false;
player->m_nPhysicalFlags.bCollisionProof = false;
player->m_nPhysicalFlags.bExplosionProof = false;
player->m_nPhysicalFlags.bFireProof = false;
player->m_nPhysicalFlags.bMeeleProof = false;
player->m_nPhysicalFlags.bBulletProof = 0;
player->m_nPhysicalFlags.bCollisionProof = 0;
player->m_nPhysicalFlags.bExplosionProof = 0;
player->m_nPhysicalFlags.bFireProof = 0;
player->m_nPhysicalFlags.bMeeleProof = 0;
#elif GTAVC
player->m_nFlags.bBulletProof = 0;
player->m_nFlags.bCollisionProof = 0;
player->m_nFlags.bExplosionProof = 0;
player->m_nFlags.bFireProof = 0;
player->m_nFlags.bMeleeProof = 0;
#endif
m_bGodMode = false;
}
else
@ -139,6 +177,7 @@ Player::Player()
};
}
#ifdef GTASA
void Player::ChangePlayerCloth(std::string& name)
{
std::stringstream ss(name);
@ -176,11 +215,14 @@ void Player::ChangePlayerCloth(std::string& name)
}
CClothes::RebuildPlayer(player, false);
}
#endif
#ifdef GTASA
void Player::ChangePlayerModel(std::string& model)
{
bool custom_skin = std::find(m_CustomSkins::m_List.begin(), m_CustomSkins::m_List.end(), model) !=
m_CustomSkins::m_List.end();
if (Ped::m_PedData.m_Json.m_Data.contains(model) || custom_skin)
{
CPlayerPed* player = FindPlayerPed();
@ -210,12 +252,24 @@ void Player::ChangePlayerModel(std::string& model)
}
}
}
#elif GTAVC
void Player::ChangePlayerModel(std::string& cat, std::string& name, std::string& id)
{
CPlayerPed* player = FindPlayerPed();
player->Undress(id.c_str());
CStreaming::LoadAllRequestedModels(false);
player->Dress();
}
#endif
void Player::Draw()
{
CPlayerPed* pPlayer = FindPlayerPed();
int hplayer = CPools::GetPedRef(pPlayer);
#ifdef GTASA
CPad* pad = pPlayer->GetPadFromPlayer();
#endif
CPlayerInfo *pInfo = &CWorld::Players[CWorld::PlayerInFocus];
if (ImGui::Button("Copy coordinates", ImVec2(Ui::GetSize(2))))
{
@ -227,7 +281,9 @@ void Player::Draw()
}
ImGui::SameLine();
if (ImGui::Button("Suicide", ImVec2(Ui::GetSize(2))))
{
pPlayer->m_fHealth = 0.0;
}
ImGui::Spacing();
@ -241,36 +297,60 @@ void Player::Draw()
ImGui::Columns(2, 0, false);
#ifdef GTASA
Ui::CheckboxAddress("Bounty on yourself", 0x96913F);
#endif
Ui::CheckboxAddress("Free healthcare", (int)&pInfo->m_bFreeHealthCare);
if (Ui::CheckboxWithHint("God mode", &m_bGodMode))
{
#ifdef GTASA
patch::Set<bool>(0x96916D, m_bGodMode, false);
pPlayer->m_nPhysicalFlags.bBulletProof = m_bGodMode;
pPlayer->m_nPhysicalFlags.bCollisionProof = m_bGodMode;
pPlayer->m_nPhysicalFlags.bExplosionProof = m_bGodMode;
pPlayer->m_nPhysicalFlags.bFireProof = m_bGodMode;
pPlayer->m_nPhysicalFlags.bMeeleProof = m_bGodMode;
#elif GTAVC
pPlayer->m_nFlags.bBulletProof = m_bGodMode;
pPlayer->m_nFlags.bCollisionProof = m_bGodMode;
pPlayer->m_nFlags.bExplosionProof = m_bGodMode;
pPlayer->m_nFlags.bFireProof = m_bGodMode;
pPlayer->m_nFlags.bMeleeProof = m_bGodMode;
#endif
}
#ifdef GTASA
Ui::CheckboxAddress("Higher cycle jumps", 0x969161);
Ui::CheckboxAddress("Infinite oxygen", 0x96916E);
Ui::CheckboxAddress("Infinite run", 0xB7CEE4);
if (Ui::CheckboxBitFlag("Invisible player", pPlayer->m_nPedFlags.bDontRender))
{
pPlayer->m_nPedFlags.bDontRender = (pPlayer->m_nPedFlags.bDontRender == 1) ? 0 : 1;
}
#elif GTAVC
Ui::CheckboxAddress("Infinite run", (int)&pInfo->m_bNeverGetsTired);
#endif
ImGui::NextColumn();
Ui::CheckboxWithHint("Keep position", &m_KeepPosition::m_bEnabled, "Teleport to the position you died from");
#ifdef GTASA
if (Ui::CheckboxBitFlag("Lock control", pad->bPlayerSafe))
{
pad->bPlayerSafe = (pad->bPlayerSafe == 1) ? 0 : 1;
}
Ui::CheckboxAddress("Mega jump", 0x96916C);
Ui::CheckboxAddress("Mega punch", 0x969173);
Ui::CheckboxAddress("Never get hungry", 0x969174);
bool never_wanted = patch::Get<bool>(0x969171, false);
if (Ui::CheckboxWithHint("Never wanted", &never_wanted))
{
CCheat::NotWantedCheat();
}
#endif
Ui::CheckboxAddress("No arrest fee", (int)&pInfo->m_bGetOutOfJailFree);
ImGui::Columns(1);
@ -279,27 +359,37 @@ void Player::Draw()
ImGui::Columns(2, 0, false);
bool state = pPlayer->m_nPhysicalFlags.bBulletProof;
bool state = BY_GAME(pPlayer->m_nPhysicalFlags.bBulletProof, pPlayer->m_nFlags.bBulletProof);
if (Ui::CheckboxWithHint("Bullet proof", &state, nullptr, m_bGodMode))
pPlayer->m_nPhysicalFlags.bBulletProof = state;
{
BY_GAME(pPlayer->m_nPhysicalFlags.bBulletProof, pPlayer->m_nFlags.bBulletProof) = state;
}
state = pPlayer->m_nPhysicalFlags.bCollisionProof;
state = BY_GAME(pPlayer->m_nPhysicalFlags.bCollisionProof, pPlayer->m_nFlags.bCollisionProof);
if (Ui::CheckboxWithHint("Collision proof", &state, nullptr, m_bGodMode))
pPlayer->m_nPhysicalFlags.bCollisionProof = state;
{
BY_GAME(pPlayer->m_nPhysicalFlags.bCollisionProof, pPlayer->m_nFlags.bCollisionProof) = state;
}
state = pPlayer->m_nPhysicalFlags.bExplosionProof;
state = BY_GAME(pPlayer->m_nPhysicalFlags.bExplosionProof, pPlayer->m_nFlags.bExplosionProof);
if (Ui::CheckboxWithHint("Explosion proof", &state, nullptr, m_bGodMode))
pPlayer->m_nPhysicalFlags.bExplosionProof = state;
{
BY_GAME(pPlayer->m_nPhysicalFlags.bExplosionProof, pPlayer->m_nFlags.bExplosionProof) = state;
}
ImGui::NextColumn();
state = pPlayer->m_nPhysicalFlags.bFireProof;
state = BY_GAME(pPlayer->m_nPhysicalFlags.bFireProof, pPlayer->m_nFlags.bFireProof);
if (Ui::CheckboxWithHint("Fire proof", &state, nullptr, m_bGodMode))
pPlayer->m_nPhysicalFlags.bFireProof = state;
{
BY_GAME(pPlayer->m_nPhysicalFlags.bFireProof, pPlayer->m_nFlags.bFireProof) = state;
}
state = pPlayer->m_nPhysicalFlags.bMeeleProof;
state = BY_GAME(pPlayer->m_nPhysicalFlags.bMeeleProof, pPlayer->m_nFlags.bMeleeProof);
if (Ui::CheckboxWithHint("Meele proof", &state, nullptr, m_bGodMode))
pPlayer->m_nPhysicalFlags.bMeeleProof = state;
{
BY_GAME(pPlayer->m_nPhysicalFlags.bMeeleProof, pPlayer->m_nFlags.bMeleeProof) = state;
}
ImGui::EndChild();
ImGui::EndTabItem();
@ -310,6 +400,7 @@ void Player::Draw()
ImGui::BeginChild("PlayerMenus");
Ui::EditReference("Armour", pPlayer->m_fArmour, 0, 100, 150);
#ifdef GTASA
if (ImGui::CollapsingHeader("Body"))
{
if (pPlayer->m_nModelIndex == 0)
@ -347,18 +438,35 @@ void Player::Draw()
Ui::EditStat("Energy", STAT_ENERGY);
Ui::EditStat("Fat", STAT_FAT);
Ui::EditReference("Health", pPlayer->m_fHealth, 0, 100, static_cast<int>(pPlayer->m_fMaxHealth));
#endif
Ui::EditReference("Health", pPlayer->m_fHealth, 0, 100, BY_GAME(static_cast<int>(pPlayer->m_fMaxHealth), 100));
#ifdef GTASA
Ui::EditStat("Lung capacity", STAT_LUNG_CAPACITY);
Ui::EditStat("Max health", STAT_MAX_HEALTH, 0, 569, 1450);
Ui::EditAddress<int>("Money", 0xB7CE50, -99999999, 0, 99999999);
#elif GTAVC
int money = pInfo->m_nMoney;
Ui::EditAddress<int>("Money", (int)&money, -9999999, 0, 99999999);
pInfo->m_nMoney = money;
pInfo->m_nDisplayMoney = money;
#endif
#ifdef GTASA
Ui::EditStat("Muscle", STAT_MUSCLE);
Ui::EditStat("Respect", STAT_RESPECT);
Ui::EditStat("Stamina", STAT_STAMINA);
#endif
if (ImGui::CollapsingHeader("Wanted level"))
{
#ifdef GTASA
int val = pPlayer->m_pPlayerData->m_pWanted->m_nWantedLevel;
int max_wl = pPlayer->m_pPlayerData->m_pWanted->MaximumWantedLevel;
max_wl = max_wl < 6 ? 6 : max_wl;
#elif GTAVC
int val = pPlayer->m_pWanted->m_nWantedLevel;
int max_wl = 6;
#endif
ImGui::Columns(3, 0, false);
ImGui::Text("Min: 0");
@ -371,21 +479,45 @@ void Player::Draw()
ImGui::Spacing();
if (ImGui::InputInt("Set value##Wanted level", &val))
{
#ifdef GTASA
pPlayer->CheatWantedLevel(val);
#elif GTAVC
pPlayer->m_pWanted->CheatWantedLevel(val);
#endif
}
ImGui::Spacing();
if (ImGui::Button("Minimum##Wanted level", Ui::GetSize(3)))
{
#ifdef GTASA
pPlayer->CheatWantedLevel(0);
#elif GTAVC
pPlayer->m_pWanted->CheatWantedLevel(0);
#endif
}
ImGui::SameLine();
if (ImGui::Button("Default##Wanted level", Ui::GetSize(3)))
{
#ifdef GTASA
pPlayer->CheatWantedLevel(0);
#elif GTAVC
pPlayer->m_pWanted->CheatWantedLevel(0);
#endif
}
ImGui::SameLine();
if (ImGui::Button("Maximum##Wanted level", Ui::GetSize(3)))
{
#ifdef GTASA
pPlayer->CheatWantedLevel(max_wl);
#elif GTAVC
pPlayer->m_pWanted->CheatWantedLevel(max_wl);
#endif
}
ImGui::Spacing();
ImGui::Separator();
@ -395,14 +527,15 @@ void Player::Draw()
ImGui::EndTabItem();
}
#ifdef GTASA
if (ImGui::BeginTabItem("Appearance"))
{
ImGui::Spacing();
if (Ui::CheckboxWithHint("Aim skin changer", &m_bAimSkinChanger,
(("Changes to the ped, player is targeting with a weapon.\nTo use aim a ped with a weapon and press ")
+ Ui::GetHotKeyNameString(Menu::m_HotKeys::aimSkinChanger)).c_str()))
config.SetValue("aim_skin_changer", m_bAimSkinChanger);
if (ImGui::BeginTabBar("AppearanceTabBar"))
{
if (ImGui::BeginTabItem("Clothes"))
@ -428,13 +561,13 @@ void Player::Draw()
getline(ss, temp, '$');
return temp;
}, nullptr, cloth_category, sizeof(cloth_category)/ sizeof(const char*));
}, nullptr, cloth_category, sizeof(cloth_category) / sizeof(const char*));
}
else
{
size_t count = 0;
if(ImGui::Button("Remove all", ImVec2(Ui::GetSize(2))))
if (ImGui::Button("Remove all", ImVec2(Ui::GetSize(2))))
{
CPlayerPed* player = FindPlayerPed();
for (uint i = 0; i < 18; i++)
@ -446,14 +579,14 @@ void Player::Draw()
ImGui::SameLine();
for (const char* clothName : cloth_category)
{
if(ImGui::Button(clothName, ImVec2(Ui::GetSize(2))))
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)
if (count % 2 != 0)
{
ImGui::SameLine();
}
@ -533,7 +666,16 @@ Limitations:\n\
}
ImGui::EndTabItem();
}
#elif GTAVC
if (ImGui::BeginTabItem("Skins"))
{
ImGui::Spacing();
ImGui::Text("Info");
Ui::ShowTooltip("Not all ped skins work. I've added the ones that works!");
Ui::DrawJSON(tempPedData.m_Json, tempPedData.m_Categories, tempPedData.m_Selected, tempPedData.m_Filter, ChangePlayerModel, nullptr);
ImGui::EndTabItem();
}
#endif
ImGui::EndTabBar();
}
}

View File

@ -1,11 +1,11 @@
#pragma once
#include "pch.h"
class Player
{
private:
inline static bool m_bGodMode;
inline static int m_nUiBodyState;
inline static bool m_bAimSkinChanger;
inline static SSearchData m_ClothData;
inline static bool m_bImagesLoaded;
inline static bool m_bModloaderInstalled;
struct m_KeepPosition
@ -13,16 +13,29 @@ private:
inline static bool m_bEnabled = false;
inline static CVector m_fPos;
};
#ifdef GTASA
inline static int m_nUiBodyState;
inline static SSearchData m_ClothData;
struct m_CustomSkins
{
inline static std::string m_Path = paths::GetGameDirPathA() + std::string("\\modloader\\Custom Skins\\");;
inline static ImGuiTextFilter m_Filter;
inline static std::vector<std::string> m_List;
};
#endif
public:
Player();
static void ChangePlayerCloth(std::string& model);
#ifdef GTASA
static void ChangePlayerModel(std::string& model);
#elif GTAVC
static void ChangePlayerModel(std::string& cat, std::string& name, std::string& id);
#endif
static void Draw();
#ifdef GTASA
static void ChangePlayerCloth(std::string& model);
#endif
};

View File

@ -51,7 +51,7 @@ Teleport::Teleport()
CPlayerPed* player = FindPlayerPed();
#ifdef GTASA
CEntity* player_entity = FindPlayerEntity();
CEntity* player_entity = FindPlayerEntity(-1);
m_Teleport::m_fPos.z = CWorld::FindGroundZFor3DCoord(m_Teleport::m_fPos.x, m_Teleport::m_fPos.y,
m_Teleport::m_fPos.z + 100.0f, nullptr, &player_entity) + 1.0f;
#elif GTAVC

View File

@ -8,29 +8,29 @@ private:
inline static bool m_bInsertCoord;
inline static bool m_bQuickTeleport;
inline static char m_nInputBuffer[INPUT_BUFFER_SIZE];
inline static SSearchData tp_data{"teleport"};
inline static SSearchData tp_data{ "teleport" };
inline static char m_nLocationBuffer[INPUT_BUFFER_SIZE];
inline static uint m_nQuickTeleportTimer;
#ifdef GTASA
#ifdef GTASA
inline static CJson m_SpriteJson = CJson("radar sprite");
#endif
#endif
struct m_Teleport
{
inline static bool m_bEnabled;
inline static CVector m_fPos = {-1, -1, -1};
inline static CVector m_fPos = { -1, -1, -1 };
inline static uint m_nTimer;
};
#ifdef GTASA
/*
#ifdef GTASA
/*
Generates radar sprite coordinates on the fly.
Shouldn't get saved in 'teleport.json', needs to be cleared at game shutdown.
*/
*/
static void FetchRadarSpriteData();
#endif
#endif
protected:
Teleport();

View File

@ -45,7 +45,7 @@ bool Ui::ListBoxStr(const char* label, std::vector<std::string>& all_items, std:
bool Ui::ListBoxCustomNames(const char* label, std::vector<std::string>& all_items, std::string& selected, const char* custom_names[], size_t length)
{
bool rtn = false;
std::string display_selected = (selected == "All") ? selected: custom_names[std::stoi(selected)];
std::string display_selected = (selected == "All") ? selected : custom_names[std::stoi(selected)];
if (ImGui::BeginCombo(label, display_selected.c_str()))
{
@ -540,8 +540,7 @@ void Ui::DrawImages(std::vector<std::unique_ptr<STextureStructure>>& img_vec, Im
}
else
{
IDirect3DTexture9* texture = (IDirect3DTexture9*)Util::GetTextureFromRaster(img_vec[i]->m_pRwTexture);
if (ImGui::ImageButton(texture, image_size, ImVec2(0, 0), ImVec2(1, 1), 1, ImVec4(1, 1, 1, 1),ImVec4(1, 1, 1, 1)))
if (ImGui::ImageButton(img_vec[i]->m_pTexture, image_size, ImVec2(0, 0), ImVec2(1, 1), 1, ImVec4(1, 1, 1, 1), ImVec4(1, 1, 1, 1)))
{
on_left_click(text);
}

View File

@ -52,7 +52,7 @@ public:
ImGuiTextFilter& filter,
std::function<void(std::string&, std::string&, std::string&)> func_left_click,
std::function<void(std::string&, std::string&, std::string&)> func_right_click);
static void DrawImages( std::vector<std::unique_ptr<STextureStructure>>& img_vec, ImVec2 image_size,
static void DrawImages(std::vector<std::unique_ptr<STextureStructure>>& img_vec, ImVec2 image_size,
std::vector<std::string>& category_vec, std::string& selected_item, ImGuiTextFilter& filter,
std::function<void(std::string&)> on_left_click,
std::function<void(std::string&)> on_right_click,
@ -69,9 +69,9 @@ public:
static void EditRadioButtonAddress(const char* label, std::vector<NamedMemory>& named_mem);
static void EditRadioButtonAddressEx(const char* label, int addr, std::vector<NamedValue>& named_val);
#ifdef GTASA
#ifdef GTASA
static void EditStat(const char* label, int stat_id, int min = 0, int def = 0, int max = 1000);
#endif
#endif
static void FilterWithHint(const char* label, ImGuiTextFilter& filter, const char* hint);

View File

@ -3,10 +3,11 @@
#include "psapi.h"
#include "CFileLoader.h"
void Util::LoadTextureDirectory(SSearchData& data, char *path, bool pass_full_name)
void Util::LoadTextureDirectory(SSearchData& data, char* path, bool pass_full_name)
{
RwTexDictionary* pRwTexDictionary = &data.txd;
// allow SA textures for VC
pRwTexDictionary = CFileLoader::LoadTexDictionary(path);
if (pRwTexDictionary)
@ -19,6 +20,7 @@ void Util::LoadTextureDirectory(SSearchData& data, char *path, bool pass_full_na
SSearchData* sdata = reinterpret_cast<SSearchData*>(data);
sdata->m_ImagesList.push_back(std::make_unique<STextureStructure>());
sdata->m_ImagesList.back().get()->m_pRwTexture = tex;
sdata->m_ImagesList.back().get()->m_pTexture = Util::GetTextureFromRaster(tex);
std::stringstream ss(tex->name);
std::string str;
@ -41,6 +43,7 @@ void Util::LoadTextureDirectory(SSearchData& data, char *path, bool pass_full_na
SSearchData* sdata = reinterpret_cast<SSearchData*>(data);
sdata->m_ImagesList.push_back(std::make_unique<STextureStructure>());
sdata->m_ImagesList.back().get()->m_pRwTexture = tex;
sdata->m_ImagesList.back().get()->m_pTexture = Util::GetTextureFromRaster(tex);
std::stringstream ss(tex->name);
std::string str;
@ -60,7 +63,8 @@ void Util::LoadTextureDirectory(SSearchData& data, char *path, bool pass_full_na
}
}
void* Util::GetTextureFromRaster(RwTexture *pTexture)
void* Util::GetTextureFromRaster(RwTexture* pTexture)
{
RwRasterEx* raster = (RwRasterEx*)(&pTexture->raster->parent);
@ -69,7 +73,7 @@ void* Util::GetTextureFromRaster(RwTexture *pTexture)
std::string Util::GetLocationName(CVector* pos)
{
#ifdef GTASA
#ifdef GTASA
int hplayer = CPools::GetPedRef(FindPlayerPed());
int interior = 0;
@ -99,9 +103,9 @@ std::string Util::GetLocationName(CVector* pos)
return CTheZones::FindSmallestZoneForPosition(*pos, true)->GetTranslatedName() + std::string(", ") + town;
return std::string("Interior ") + std::to_string(interior) + ", " + town;
#elif GTAVC
#elif GTAVC
return "Vice City";
#endif
#endif
}
#ifdef GTASA

View File

@ -12,14 +12,14 @@ class Util
{
public:
#ifdef GTASA
#ifdef GTASA
static void ClearCharTasksVehCheck(CPed* ped);
static CPed* GetClosestPed();
static CVehicle* GetClosestVehicle();
static int GetLargestGangInZone();
static bool IsOnCutscene();
static RwTexture* LoadTextureFromMemory(char* data, unsigned int size);
#endif
#endif
static std::string GetLocationName(CVector* pos);
static bool IsOnMission();

View File

@ -329,7 +329,7 @@ void Vehicle::ParseCarcolsDAT()
getline(ss, temp, ',');
int blue = std::stoi(temp);
std::vector<float> color = {red / 255.0f, green / 255.0f, blue / 255.0f};
std::vector<float> color = { red / 255.0f, green / 255.0f, blue / 255.0f };
m_CarcolsColorData.push_back(color);
++count;
@ -796,7 +796,7 @@ void Vehicle::Draw()
if (ImGui::Button("Remove vehicles", Ui::GetSize(1)))
{
CPlayerPed* player = FindPlayerPed();
for (CVehicle *pVeh : CPools::ms_pVehiclePool)
for (CVehicle* pVeh : CPools::ms_pVehiclePool)
{
if (DistanceBetweenPoints(pVeh->GetPosition(), player->GetPosition()) < m_nVehRemoveRadius
&& !(player->m_nPedFlags.bInVehicle && player->m_pVehicle == pVeh))
@ -810,7 +810,7 @@ void Vehicle::Draw()
}
if (ImGui::CollapsingHeader("Traffic options"))
{
static std::vector<Ui::NamedMemory> color{{"Black", 0x969151}, {"Pink", 0x969150}};
static std::vector<Ui::NamedMemory> color{ {"Black", 0x969151}, {"Pink", 0x969150} };
static std::vector<Ui::NamedMemory> type{
{"Cheap", 0x96915E}, {"Country", 0x96917B}, {"Fast", 0x96915F}
};
@ -966,7 +966,7 @@ void Vehicle::Draw()
uchar r = m_Color::m_fColorPicker[0] * 255;
uchar g = m_Color::m_fColorPicker[1] * 255;
uchar b = m_Color::m_fColorPicker[2] * 255;
Paint::SetNodeColor(veh, Paint::veh_nodes::selected, {r, g, b, 255}, m_Color::m_bMatFilter);
Paint::SetNodeColor(veh, Paint::veh_nodes::selected, { r, g, b, 255 }, m_Color::m_bMatFilter);
}
ImGui::Spacing();
@ -1188,7 +1188,7 @@ void Vehicle::Draw()
ImGui::BeginChild("HandlingChild");
static std::vector<Ui::NamedValue> abs{{"On", 1}, {"Off", 0}};
static std::vector<Ui::NamedValue> abs{ {"On", 1}, {"Off", 0} };
Ui::EditRadioButtonAddressEx("Abs", pHandling + 0x9C, abs);
Ui::EditFloat("Anti dive multiplier", pHandling + 0xC4, 0.0f, 0.0f, 1.0f);
@ -1209,10 +1209,10 @@ void Vehicle::Draw()
Ui::EditFloat("Engine acceleration", pHandling + 0x7C, 0.0f, 0.0f, 49.0f, 12500.0f);
Ui::EditFloat("Engine inertia", pHandling + 0x80, 0.0f, 0.0f, 400.0f);
static std::vector<Ui::NamedValue> engine_type{{"Petrol", 80}, {"Diseal", 68}, {"Electric", 69}};
static std::vector<Ui::NamedValue> engine_type{ {"Petrol", 80}, {"Diseal", 68}, {"Electric", 69} };
Ui::EditRadioButtonAddressEx("Engine type", pHandling + 0x75, engine_type);
std::vector<Ui::NamedValue> front_lights{{"Long", 0}, {"Small", 1}, {"Big", 2}, {"Tall", 3}};
std::vector<Ui::NamedValue> front_lights{ {"Long", 0}, {"Small", 1}, {"Big", 2}, {"Tall", 3} };
Ui::EditRadioButtonAddressEx("Front lights", pHandling + 0xDC, front_lights);
Ui::EditFloat("Force level", pHandling + 0xAC, -10.0f, -10.0f, 10.0f); // test later
@ -1231,7 +1231,7 @@ void Vehicle::Draw()
Ui::EditAddress<BYTE>("Number of gears", pHandling + 0x76, 1, 1, 10);
Ui::EditAddress<BYTE>("Percent submerged", pHandling + 0x20, 10, 10, 120);
static std::vector<Ui::NamedValue> rear_lights{{"Long", 0}, {"Small", 1}, {"Big", 2}, {"Tall", 3}};
static std::vector<Ui::NamedValue> rear_lights{ {"Long", 0}, {"Small", 1}, {"Big", 2}, {"Tall", 3} };
Ui::EditRadioButtonAddressEx("Rear lights", pHandling + 0xDD, rear_lights);
Ui::EditFloat("Seat offset distance", pHandling + 0xD4, 0.0f, 0.0f, 1.0f);

View File

@ -12,7 +12,7 @@ private:
inline static bool m_bNoDamage;
inline static int m_nDoorMenuButton;
inline static std::string m_DoorNames[6] =
{"Hood", "Boot", "Front left door", "Front right door", "Rear left door", "Rear right door"};
{ "Hood", "Boot", "Front left door", "Front right door", "Rear left door", "Rear right door" };
inline static int m_nVehRemoveRadius;
inline static bool m_bLockSpeed;
inline static float m_fLockSpeed;
@ -24,11 +24,11 @@ private:
inline static bool m_bMatFilter = true;
inline static int m_nRadioButton = 1;
inline static bool bShowAll;
inline static float m_fColorPicker[3]{0, 0, 0};
inline static float m_fColorPicker[3]{ 0, 0, 0 };
};
struct m_Neon
{
inline static float m_fColorPicker[3]{0, 0, 0};
inline static float m_fColorPicker[3]{ 0, 0, 0 };
inline static bool m_bRainbowEffect;
inline static uint m_nRainbowTimer;
inline static bool m_bApplyOnTraffic;
@ -49,7 +49,7 @@ private:
inline static bool m_bCompAdded;
};
inline static std::vector<std::string> (m_HandlingFlagNames) = // 32 flags
inline static std::vector<std::string>(m_HandlingFlagNames) = // 32 flags
{
"1G_BOOST", "2G_BOOST", "NPC_ANTI_ROLL", "NPC_NEUTRAL_HANDL", "NO_HANDBRAKE", "STEER_REARWHEELS",
"HB_REARWHEEL_STEER", "ALT_STEER_OPT",
@ -61,7 +61,7 @@ private:
"Unused 4"
};
inline static std::vector<std::string> (m_ModelFlagNames) = // 32 flags
inline static std::vector<std::string>(m_ModelFlagNames) = // 32 flags
{
"IS_VAN", "IS_BUS", "IS_LOW", "IS_BIG", "REVERSE_BONNET", "HANGING_BOOT", "TAILGATE_BOOT", "NOSWING_BOOT",
"NO_DOORS", "TANDEM_SEATS",

View File

@ -57,7 +57,7 @@ bool Visual::TimeCycColorEdit3(const char* label, uchar* r, uchar* g, uchar* b,
auto green = static_cast<uchar*>(patch::GetPointer(int(g)));
auto blue = static_cast<uchar*>(patch::GetPointer(int(b)));
float col[3]{red[val] / 255.0f, green[val] / 255.0f, blue[val] / 255.0f};
float col[3]{ red[val] / 255.0f, green[val] / 255.0f, blue[val] / 255.0f };
if (ImGui::ColorEdit3(label, col, flags))
{
@ -80,7 +80,7 @@ bool Visual::TimeCycColorEdit4(const char* label, uchar* r, uchar* g, uchar* b,
auto blue = static_cast<uchar*>(patch::GetPointer(int(b)));
auto alpha = static_cast<uchar*>(patch::GetPointer(int(a)));
float col[4]{red[val] / 255.0f, green[val] / 255.0f, blue[val] / 255.0f, alpha[val] / 255.0f};
float col[4]{ red[val] / 255.0f, green[val] / 255.0f, blue[val] / 255.0f, alpha[val] / 255.0f };
if (ImGui::ColorEdit4(label, col, flags))
{
@ -322,7 +322,7 @@ void Visual::Draw()
{"No outline", 0}, {"Thin outline", 1}, {"Default outline", 2}
};
Ui::EditRadioButtonAddressEx("Money font outline", 0x58F58D, font_outline);
static std::vector<Ui::NamedValue> style{{"Style 1", 1}, {"Style 2", 2}, {"Default style", 3}};
static std::vector<Ui::NamedValue> style{ {"Style 1", 1}, {"Style 2", 2}, {"Default style", 3} };
Ui::EditRadioButtonAddressEx("Money font style", 0x58F57F, style);
Ui::EditAddress<float>("Radar Height", *(int*)0x5834F6, 0, 76, 999);
Ui::EditAddress<float>("Radar Width", *(int*)0x5834C2, 0, 94, 999);
@ -330,7 +330,7 @@ void Visual::Draw()
Ui::EditAddress<float>("Radar posY", *(int*)0x583500, -999, 104, 999);
Ui::EditAddress<int>("Radar zoom", 0xA444A3, 0, 0, 170);
Ui::ColorPickerAddress("Radio station color", 0xBAB24C, ImVec4(150, 150, 150, 255));
static std::vector<Ui::NamedValue> star_border{{"No border", 0}, {"Default", 1}, {"Bold border", 2}};
static std::vector<Ui::NamedValue> star_border{ {"No border", 0}, {"Default", 1}, {"Bold border", 2} };
Ui::EditRadioButtonAddressEx("Wanted star border", 0x58DD41, star_border);
Ui::EditAddress<float>("Wanted posX", *(int*)0x58DD0F, -999, 29, 999);
Ui::EditAddress<float>("Wanted posY", *(int*)0x58DDFC, -999, 114, 999);
@ -400,6 +400,17 @@ void Visual::Draw()
Ui::ShowTooltip("Sync system time is enabled.\n(Game/Sync system time)");
}
if (ImGui::Checkbox("Freeze game time", &Game::m_bFreezeTime))
{
if (Game::m_bFreezeTime)
{
patch::SetRaw(0x52CF10, (char*)"\xEB\xEF", 2);
}
else
{
patch::SetRaw(0x52CF10, (char*)"\x56\x8B", 2);
}
}
ImGui::Spacing();
if (ImGui::BeginTabBar("Timecyc subtab", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
{

View File

@ -3,7 +3,7 @@
class Weapon
{
public:
inline static SSearchData m_WeaponData{"weapon"};
inline static SSearchData m_WeaponData{ "weapon" };
inline static bool m_bImagesLoaded;
inline static bool m_bAutoAim;
inline static bool m_bFastReload;

View File

@ -131,6 +131,7 @@ struct STextureStructure
std::string m_FileName;
std::string m_CategoryName;
RwTexture *m_pRwTexture = nullptr;
void *m_pTexture = nullptr;
};
struct SSearchData

View File

@ -65,6 +65,8 @@ project "CheatMenuVC"
"../src/Json.cpp",
"../src/Teleport.h",
"../src/Teleport.cpp",
"../src/Player.h",
"../src/Player.cpp",
"../src/Ui.h",
"../src/Ui.cpp",
"../src/Util.h",