CheatMenuSA/src/player.cpp

910 lines
32 KiB
C++
Raw Normal View History

2021-10-25 10:03:27 -04:00
#include "pch.h"
2021-09-20 08:41:40 -04:00
#include "player.h"
#include "menu.h"
#include "ui.h"
#include "util.h"
2022-01-07 03:18:00 -05:00
2021-08-06 11:53:18 -04:00
#ifdef GTASA
2021-09-20 08:41:40 -04:00
#include "ped.h"
2021-08-06 11:53:18 -04:00
2022-06-28 16:23:03 -04:00
static inline const char* clothNameList[18] =
{
"Shirts", "Heads", "Trousers", "Shoes", "Tattoos left lower arm", "Tattoos left upper arm",
"Tattoos right upper arm", "Tattoos right lower arm", "Tattoos back", "Tattoos left chest",
"Tattoos right chest", "Tattoos stomach", "Tattoos lower back", "Necklaces", "Watches",
"Glasses", "Hats", "Extras"
};
2021-09-20 08:41:40 -04:00
static inline void PlayerModelBrokenFix()
{
2022-01-07 03:18:00 -05:00
CPlayerPed* pPlayer = FindPlayerPed();
2022-01-07 03:18:00 -05:00
if (pPlayer->m_nModelIndex == 0)
{
2022-01-07 03:18:00 -05:00
Call<0x5A81E0>(0, pPlayer->m_pPlayerData->m_pPedClothesDesc, 0xBC1C78, false);
}
}
/*
2021-10-25 10:03:27 -04:00
Taken from gta chaos mod by Lordmau5
https://github.com/gta-chaos-mod/Trilogy-ASI-Script
*/
2022-06-28 16:23:03 -04:00
void Player::TopDownCamera::Process()
{
2022-01-07 03:18:00 -05:00
CPlayerPed *player = FindPlayerPed ();
CVector pos = player->GetPosition ();
2022-06-28 16:23:03 -04:00
float curOffset = m_fOffset;
2022-01-07 03:18:00 -05:00
// drunk effect causes issues
Command<eScriptCommands::COMMAND_SET_PLAYER_DRUNKENNESS> (0, 0);
CVehicle *vehicle = FindPlayerVehicle(-1, false);
// TODO: implement smooth transition
if (vehicle)
{
float speed = vehicle->m_vecMoveSpeed.Magnitude();
if (speed > 1.2f)
{
speed = 1.2f;
}
if (speed * 40.0f > 40.0f)
{
speed = 40.0f;
}
if (speed < 0.0f)
{
speed = 0.0f;
}
curOffset += speed;
}
CVector playerOffset = CVector (pos.x, pos.y, pos.z + 2.0f);
CVector cameraPos
= CVector (playerOffset.x, playerOffset.y, playerOffset.z + curOffset);
CColPoint outColPoint;
CEntity * outEntity;
// TODO: Which variable? X, Y or Z for the look direction?
if (CWorld::ProcessLineOfSight (playerOffset, cameraPos, outColPoint,
outEntity, true, true, true, true, true,
true, true, true))
{
Command<eScriptCommands::COMMAND_SET_FIXED_CAMERA_POSITION> (
outColPoint.m_vecPoint.x, outColPoint.m_vecPoint.y,
outColPoint.m_vecPoint.z, 0.0f, 0.0f, 0.0f);
}
else
{
Command<eScriptCommands::COMMAND_SET_FIXED_CAMERA_POSITION> (
cameraPos.x, cameraPos.y, cameraPos.z, 0.0f, 0.0f, 0.0f);
}
Command<eScriptCommands::COMMAND_POINT_CAMERA_AT_POINT> (pos.x, pos.y,
pos.z, 2);
TheCamera.m_fGenerationDistMultiplier = 10.0f;
TheCamera.m_fLODDistMultiplier = 10.0f;
}
2021-08-06 11:53:18 -04:00
#endif
void Player::Init()
2020-12-02 16:19:16 -05:00
{
2021-08-06 11:53:18 -04:00
#ifdef GTASA
2021-10-25 10:03:27 -04:00
// Fix player model being broken after rebuild
2022-01-07 03:18:00 -05:00
patch::RedirectCall(0x5A834D, &PlayerModelBrokenFix);
2022-06-16 06:51:22 -04:00
m_bAimSkinChanger = gConfig.Get("Features.AimSkinChanger", false);
2021-08-07 12:01:44 -04:00
#endif
2020-12-02 16:19:16 -05:00
2022-01-07 03:18:00 -05:00
// Custom skins setup
std::string path = GAME_PATH((char*)"modloader/");
if (GetModuleHandle("modloader.asi") && std::filesystem::is_directory(path))
2022-01-07 03:18:00 -05:00
{
2021-08-06 11:53:18 -04:00
#ifdef GTASA
path += "CustomSkins/";
if (std::filesystem::is_directory(path))
2022-01-07 03:18:00 -05:00
{
for (auto& p : std::filesystem::recursive_directory_iterator(path))
2022-01-07 03:18:00 -05:00
{
if (p.path().extension() == ".dff")
{
std::string file_name = p.path().stem().string();
if (file_name.size() < 9)
{
2022-06-26 08:08:55 -04:00
CustomSkins::m_List.push_back(file_name);
}
2022-01-07 03:18:00 -05:00
else
{
2022-06-15 06:45:43 -04:00
Log::Print<eLogLevel::Error>("Custom Skin longer than 8 characters {}", file_name);
}
2022-01-07 03:18:00 -05:00
}
}
}
else
{
std::filesystem::create_directory(path);
2022-01-07 03:18:00 -05:00
}
2021-08-06 11:53:18 -04:00
#endif
2021-02-24 16:54:45 -05:00
2022-01-07 03:18:00 -05:00
m_bModloaderInstalled = true;
}
Events::processScriptsEvent += []
{
uint timer = CTimer::m_snTimeInMilliseconds;
CPlayerPed* player = FindPlayerPed();
int hplayer = CPools::GetPedRef(player);
if (m_bHealthRegen)
2022-01-07 03:18:00 -05:00
{
static uint lastDmgTimer = 0;
static uint lastHealTimer = 0;
static float health = 0;
float maxHealth = BY_GAME(player->m_fMaxHealth, 100, 100);
if (player->m_fHealth != health)
{
health = player->m_fHealth;
lastDmgTimer = timer;
}
if (player->m_fHealth != maxHealth
&& timer - lastDmgTimer > 5000
&& timer - lastHealTimer > 1000
)
{
player->m_fHealth += 0.2f;
lastHealTimer = timer;
health = player->m_fHealth;
}
}
2022-06-26 08:08:55 -04:00
if (KeepPosition::m_bEnabled)
2022-01-07 03:18:00 -05:00
{
if (Command<Commands::IS_CHAR_DEAD>(hplayer))
{
2022-06-26 08:08:55 -04:00
KeepPosition::m_fPos = player->GetPosition();
2022-01-07 03:18:00 -05:00
}
else
{
CVector cur_pos = player->GetPosition();
2022-06-26 08:08:55 -04:00
if (KeepPosition::m_fPos.x != 0 && KeepPosition::m_fPos.x != cur_pos.x
&& KeepPosition::m_fPos.y != 0 && KeepPosition::m_fPos.y != cur_pos.y)
2022-01-07 03:18:00 -05:00
{
2022-06-26 08:08:55 -04:00
BY_GAME(player->Teleport(KeepPosition::m_fPos, false)
, player->Teleport(KeepPosition::m_fPos), player->Teleport(KeepPosition::m_fPos));
KeepPosition::m_fPos = CVector(0, 0, 0);
2022-01-07 03:18:00 -05:00
}
}
}
if (m_bGodMode)
{
2021-08-06 11:53:18 -04:00
#ifdef GTASA
2022-01-07 03:18:00 -05:00
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.bMeleeProof = 1;
2021-08-06 11:53:18 -04:00
#elif GTAVC
2022-01-07 03:18:00 -05:00
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;
#else
player->m_nFlags.bBulletProof = m_bGodMode;
player->m_nFlags.bCollisionProof = m_bGodMode;
player->m_nFlags.bExplosionProof = m_bGodMode;
player->m_nFlags.bFireProof = m_bGodMode;
player->m_nFlags.bMeleeProof = m_bGodMode;
2021-08-06 11:53:18 -04:00
#endif
2022-01-07 03:18:00 -05:00
}
2021-02-24 16:54:45 -05:00
2021-08-06 11:53:18 -04:00
#ifdef GTASA
2022-06-26 08:08:55 -04:00
if (m_bDrunkEffect && !TopDownCamera::m_bEnabled)
2022-01-07 03:18:00 -05:00
{
Command<eScriptCommands::COMMAND_SET_PLAYER_DRUNKENNESS> (0, 100);
}
2022-06-26 08:08:55 -04:00
if (TopDownCamera::m_bEnabled)
2022-01-07 03:18:00 -05:00
{
2022-06-28 16:23:03 -04:00
TopDownCamera::Process();
2022-01-07 03:18:00 -05:00
}
if (m_bAimSkinChanger && aimSkinChanger.Pressed())
{
CPed* targetPed = player->m_pPlayerTargettedPed;
if (targetPed)
{
player->SetModelIndex(targetPed->m_nModelIndex);
Util::ClearCharTasksVehCheck(player);
}
}
2021-08-06 11:53:18 -04:00
#endif
2022-01-07 03:18:00 -05:00
if (godMode.Pressed())
{
if (m_bGodMode)
{
2022-02-27 14:02:11 -05:00
SetHelpMessage(TEXT("Player.GodDisabled"));
2021-08-06 11:53:18 -04:00
#ifdef GTASA
2022-01-07 03:18:00 -05:00
patch::Set<bool>(0x96916D, m_bGodMode, false);
player->m_nPhysicalFlags.bBulletProof = 0;
player->m_nPhysicalFlags.bCollisionProof = 0;
player->m_nPhysicalFlags.bExplosionProof = 0;
player->m_nPhysicalFlags.bFireProof = 0;
player->m_nPhysicalFlags.bMeleeProof = 0;
2021-08-06 11:53:18 -04:00
#elif GTAVC
2022-01-07 03:18:00 -05:00
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;
#else
player->m_nFlags.bBulletProof = m_bGodMode;
player->m_nFlags.bCollisionProof = m_bGodMode;
player->m_nFlags.bExplosionProof = m_bGodMode;
player->m_nFlags.bFireProof = m_bGodMode;
player->m_nFlags.bMeleeProof = m_bGodMode;
2021-08-06 11:53:18 -04:00
#endif
2022-01-07 03:18:00 -05:00
m_bGodMode = false;
}
else
{
2022-02-27 14:02:11 -05:00
SetHelpMessage(TEXT("Player.GodEnabled"));
2022-01-07 03:18:00 -05:00
m_bGodMode = true;
}
}
};
2020-12-02 16:19:16 -05:00
}
2021-08-06 11:53:18 -04:00
#ifdef GTASA
2021-10-25 10:03:27 -04:00
void Player::ChangePlayerCloth(std::string& name)
2020-12-02 16:19:16 -05:00
{
2022-01-07 03:18:00 -05:00
std::stringstream ss(name);
std::string temp;
getline(ss, temp, '$');
int body_part = std::stoi(temp);
getline(ss, temp, '$');
std::string model = temp.c_str();
getline(ss, temp, '$');
std::string texName = temp.c_str();
CPlayerPed* player = FindPlayerPed();
if (texName == "cutoffchinosblue")
{
player->m_pPlayerData->m_pPedClothesDesc->SetTextureAndModel(-697413025, 744365350, body_part);
}
else
{
if (texName == "sneakerbincblue")
{
player->m_pPlayerData->m_pPedClothesDesc->SetTextureAndModel(-915574819, 2099005073, body_part);
}
else
{
if (texName == "12myfac")
{
player->m_pPlayerData->m_pPedClothesDesc->SetTextureAndModel(-1750049245, 1393983095, body_part);
}
else
{
player->m_pPlayerData->m_pPedClothesDesc->SetTextureAndModel(texName.c_str(), model.c_str(), body_part);
}
}
}
CClothes::RebuildPlayer(player, false);
2020-12-02 16:19:16 -05:00
}
2021-08-06 11:53:18 -04:00
#endif
2020-12-02 16:19:16 -05:00
2021-08-06 11:53:18 -04:00
#ifdef GTASA
2021-10-25 10:03:27 -04:00
void Player::ChangePlayerModel(std::string& model)
2020-12-02 16:19:16 -05:00
{
2022-06-26 08:08:55 -04:00
bool custom_skin = std::find(CustomSkins::m_List.begin(), CustomSkins::m_List.end(), model) !=
CustomSkins::m_List.end();
2022-01-07 03:18:00 -05:00
2022-06-15 06:45:43 -04:00
if (Ped::m_PedData.m_pData->Contains(model.c_str()) || custom_skin)
2022-01-07 03:18:00 -05:00
{
CPlayerPed* player = FindPlayerPed();
2022-06-15 06:45:43 -04:00
if (Ped::m_SpecialPedData.Contains(model.c_str()) || custom_skin)
2022-01-07 03:18:00 -05:00
{
std::string name;
2022-06-15 06:45:43 -04:00
if (Ped::m_SpecialPedData.Contains(model.c_str()))
{
name = Ped::m_SpecialPedData.Get(model.c_str(), "Unknown");
}
2022-01-07 03:18:00 -05:00
else
2022-06-15 06:45:43 -04:00
{
2022-01-07 03:18:00 -05:00
name = model;
2022-06-15 06:45:43 -04:00
}
2022-01-07 03:18:00 -05:00
CStreaming::RequestSpecialChar(1, name.c_str(), PRIORITY_REQUEST);
CStreaming::LoadAllRequestedModels(true);
player->SetModelIndex(291);
CStreaming::SetSpecialCharIsDeletable(291);
}
else
{
int imodel = std::stoi(model);
CStreaming::RequestModel(imodel, eStreamingFlags::PRIORITY_REQUEST);
CStreaming::LoadAllRequestedModels(false);
player->SetModelIndex(imodel);
CStreaming::SetModelIsDeletable(imodel);
}
Util::ClearCharTasksVehCheck(player);
}
2020-12-02 16:19:16 -05:00
}
2022-01-07 03:18:00 -05:00
#else
2021-10-25 10:03:27 -04:00
void Player::ChangePlayerModel(std::string& cat, std::string& key, std::string& val)
2021-08-06 11:53:18 -04:00
{
2022-01-07 03:18:00 -05:00
CPlayerPed* player = FindPlayerPed();
2021-10-22 18:03:27 -04:00
#ifdef GTAVC
2022-01-07 03:18:00 -05:00
player->Undress(val.c_str());
CStreaming::LoadAllRequestedModels(false);
player->Dress();
#else
if (cat == "Special")
{
// CStreaming::RequestSpecialChar(109, val.c_str(), PRIORITY_REQUEST);
// CStreaming::LoadAllRequestedModels(true);
// player->SetModelIndex(109);
// CStreaming::SetMissionDoesntRequireSpecialChar(109);
2022-02-27 14:02:11 -05:00
SetHelpMessage(TEXT("Player.SpecialNotImplement"));
2022-01-07 03:18:00 -05:00
}
else
{
int imodel = std::stoi(val);
CStreaming::RequestModel(imodel, eStreamingFlags::PRIORITY_REQUEST);
CStreaming::LoadAllRequestedModels(true);
player->DeleteRwObject();
player->SetModelIndex(imodel);
CStreaming::SetModelIsDeletable(imodel);
}
2021-10-22 18:03:27 -04:00
#endif
2021-08-06 11:53:18 -04:00
}
#endif
2020-12-02 16:19:16 -05:00
2022-01-20 02:04:45 -05:00
void Player::ShowPage()
2020-12-02 16:19:16 -05:00
{
2022-01-07 03:18:00 -05:00
CPlayerPed* pPlayer = FindPlayerPed();
int hplayer = CPools::GetPedRef(pPlayer);
2021-08-06 11:53:18 -04:00
#ifdef GTASA
2022-01-07 03:18:00 -05:00
CPad* pad = pPlayer->GetPadFromPlayer();
2021-08-06 11:53:18 -04:00
#endif
2022-01-07 03:18:00 -05:00
CPlayerInfo *pInfo = &CWorld::Players[CWorld::PlayerInFocus];
2020-12-02 16:19:16 -05:00
2022-02-27 14:02:11 -05:00
if (ImGui::Button(TEXT("Player.CopyCoordinates"), ImVec2(Ui::GetSize(2))))
2022-01-07 03:18:00 -05:00
{
CVector pos = pPlayer->GetPosition();
std::string text = std::to_string(pos.x) + ", " + std::to_string(pos.y) + ", " + std::to_string(pos.z);
2020-12-02 16:19:16 -05:00
2022-01-07 03:18:00 -05:00
ImGui::SetClipboardText(text.c_str());
2022-02-27 14:02:11 -05:00
SetHelpMessage(TEXT("Player.CoordCopied"));
2022-01-07 03:18:00 -05:00
}
ImGui::SameLine();
2022-02-27 14:02:11 -05:00
if (ImGui::Button(TEXT("Player.Suicide"), ImVec2(Ui::GetSize(2))))
2022-01-07 03:18:00 -05:00
{
pPlayer->m_fHealth = 0.0;
}
2021-02-24 16:54:45 -05:00
2022-01-07 03:18:00 -05:00
ImGui::Spacing();
2020-12-02 16:19:16 -05:00
2022-01-07 03:18:00 -05:00
if (ImGui::BeginTabBar("Player", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
{
2022-02-27 14:02:11 -05:00
if (ImGui::BeginTabItem(TEXT("Window.CheckboxTab")))
2022-01-07 03:18:00 -05:00
{
ImGui::Spacing();
2020-12-02 16:19:16 -05:00
2022-01-07 03:18:00 -05:00
ImGui::BeginChild("CheckboxesChild");
2020-12-02 16:19:16 -05:00
2022-01-07 03:18:00 -05:00
ImGui::Columns(2, 0, false);
2020-12-02 16:19:16 -05:00
2021-08-06 11:53:18 -04:00
#ifdef GTASA
2022-02-27 14:02:11 -05:00
Ui::CheckboxAddress(TEXT("Player.BountyYourself"), 0x96913F);
2022-01-07 03:18:00 -05:00
2022-06-26 08:08:55 -04:00
ImGui::BeginDisabled(TopDownCamera::m_bEnabled);
2022-02-27 14:02:11 -05:00
if (Ui::CheckboxWithHint(TEXT("Player.DrunkEffect"), &m_bDrunkEffect))
2022-01-07 03:18:00 -05:00
{
if (!m_bDrunkEffect)
{
Command<eScriptCommands::COMMAND_SET_PLAYER_DRUNKENNESS> (0, 0);
}
}
2022-02-27 14:02:11 -05:00
if (Ui::CheckboxWithHint(TEXT("Player.FastSprint"), &m_bFastSprint, TEXT("Player.FastSprintTip")))
2022-01-07 03:18:00 -05:00
{
2022-02-27 14:02:11 -05:00
patch::Set<float>(0x8D2458, m_bFastSprint ? 0.1f : 5.0f);
2022-01-07 03:18:00 -05:00
}
ImGui::EndDisabled();
2021-08-06 11:53:18 -04:00
#endif
2022-05-16 14:42:00 -04:00
Ui::CheckboxAddress(TEXT("Player.FreeHealthcare"), (int)&pInfo->m_bGetOutOfHospitalFree);
2021-08-06 11:53:18 -04:00
if (Ui::CheckboxWithHint(TEXT("Player.FreezeWL"), &m_bFreezeWantedLevel))
{
static unsigned int chaosLvl;
if (m_bFreezeWantedLevel)
{
#ifdef GTASA
chaosLvl = pPlayer->GetWanted()->m_nChaosLevel;
#else
chaosLvl = pPlayer->m_pWanted->m_nChaosLevel;
#endif
patch::SetUChar(BY_GAME(0x561C90, 0x4D2110, 0x4AD900), 0xC3);
}
else
{
#ifdef GTASA
pPlayer->GetWanted()->m_nChaosLevel = chaosLvl;
#else
pPlayer->m_pWanted->m_nChaosLevel = chaosLvl;
#endif
patch::SetUChar(BY_GAME(0x561C90, 0x4D2110, 0x4AD900), BY_GAME(0x51, 0x8B, 0xA1));
}
}
2022-02-27 14:02:11 -05:00
if (Ui::CheckboxWithHint(TEXT("Player.GodMode"), &m_bGodMode))
2022-01-07 03:18:00 -05:00
{
2021-08-06 11:53:18 -04:00
#ifdef GTASA
2022-01-07 03:18:00 -05:00
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.bMeleeProof = m_bGodMode;
2021-08-06 11:53:18 -04:00
#elif GTAVC
2022-01-07 03:18:00 -05:00
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;
#else
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;
2021-08-06 11:53:18 -04:00
#endif
2022-01-07 03:18:00 -05:00
}
2022-02-27 14:02:11 -05:00
Ui::CheckboxWithHint(TEXT("Player.HealthRegen"), &m_bHealthRegen, TEXT("Player.HealthRegenTip"));
2021-08-06 11:53:18 -04:00
#ifdef GTASA
2022-02-27 14:02:11 -05:00
Ui::CheckboxAddress(TEXT("Player.CycleJump"), 0x969161);
Ui::CheckboxAddress(TEXT("Player.InfO2"), 0x96916E);
if (Ui::CheckboxBitFlag(TEXT("Player.InvisPlayer"), pPlayer->m_nPedFlags.bDontRender))
2022-01-07 03:18:00 -05:00
{
pPlayer->m_nPedFlags.bDontRender = !pPlayer->m_nPedFlags.bDontRender;
2022-01-07 03:18:00 -05:00
}
2022-02-27 14:02:11 -05:00
Ui::CheckboxAddress(TEXT("Player.InfSprint"), 0xB7CEE4);
2022-01-07 03:18:00 -05:00
#else
Ui::CheckboxAddress(TEXT("Player.InfSprint"), (int)&pInfo->m_bInfiniteSprint);
2021-08-06 11:53:18 -04:00
#endif
2021-02-24 16:54:45 -05:00
2022-01-07 03:18:00 -05:00
ImGui::NextColumn();
2020-12-02 16:19:16 -05:00
2021-08-06 11:53:18 -04:00
#ifdef GTASA
2022-02-27 14:02:11 -05:00
if (Ui::CheckboxBitFlag(TEXT("Player.LockControl"), pad->bPlayerSafe))
2022-01-07 03:18:00 -05:00
{
pad->bPlayerSafe = !pad->bPlayerSafe;
2022-01-07 03:18:00 -05:00
}
2022-02-27 14:02:11 -05:00
Ui::CheckboxAddressEx(TEXT("Player.MaxAppeal"), 0x969180, 1, 0);
Ui::CheckboxAddress(TEXT("Player.MegaJump"), 0x96916C);
Ui::CheckboxAddress(TEXT("Player.MegaPunch"), 0x969173);
Ui::CheckboxAddress(TEXT("Player.NeverGetHungry"), 0x969174);
2022-01-07 03:18:00 -05:00
bool never_wanted = patch::Get<bool>(0x969171, false);
2022-02-27 14:02:11 -05:00
if (Ui::CheckboxWithHint(TEXT("Player.NeverWanted"), &never_wanted))
2022-01-07 03:18:00 -05:00
{
CCheat::NotWantedCheat();
}
#else
static bool neverWanted = false;
2022-02-27 14:02:11 -05:00
if (Ui::CheckboxWithHint(TEXT("Player.NeverWanted"), &neverWanted))
2022-01-07 03:18:00 -05:00
{
if (neverWanted)
{
2021-10-22 18:03:27 -04:00
#ifdef GTA3
2022-01-07 03:18:00 -05:00
pPlayer->m_pWanted->SetWantedLevel(0);
2021-10-22 18:03:27 -04:00
#else
2022-01-07 03:18:00 -05:00
pPlayer->m_pWanted->CheatWantedLevel(0);
2021-10-22 18:03:27 -04:00
#endif
2022-01-07 03:18:00 -05:00
pPlayer->m_pWanted->Update();
patch::SetRaw(BY_GAME(NULL, 0x4D2110, 0x4AD900), (char*)"\xC3\x90\x90\x90\x90\x90", 6); // CWanted::UpdateWantedLevel()
patch::Nop(BY_GAME(NULL, 0x5373D0, 0x4EFE73), 5); // CWanted::Update();
}
else
{
pPlayer->m_pWanted->ClearQdCrimes();
2021-10-22 18:03:27 -04:00
#ifdef GTA3
2022-01-07 03:18:00 -05:00
pPlayer->m_pWanted->SetWantedLevel(0);
patch::SetRaw(0x4AD900, (char*)"\xA1\x18\x77\x5F\x00", 6);
patch::SetRaw(0x4EFE73, (char*)"\xE8\x38\xD9\xFB\xFF", 5);
2021-10-22 18:03:27 -04:00
#else
2022-01-07 03:18:00 -05:00
pPlayer->m_pWanted->CheatWantedLevel(0);
patch::SetRaw(0x4D2110, (char*)"\x8B\x15\xDC\x10\x69\x00", 6);
patch::SetRaw(0x5373D0, (char*)"\xE8\x8B\xAE\xF9\xFF", 5);
2021-10-22 18:03:27 -04:00
#endif
2022-01-07 03:18:00 -05:00
}
}
2021-08-06 11:53:18 -04:00
#endif
2022-02-27 14:02:11 -05:00
Ui::CheckboxAddress(TEXT("Player.NoFee"), (int)&pInfo->m_bGetOutOfJailFree);
2022-06-26 08:08:55 -04:00
Ui::CheckboxWithHint(TEXT("Player.RespawnDieLoc"), &KeepPosition::m_bEnabled, TEXT("Player.RespawnDieLocTip"));
#ifdef GTASA
static bool sprintInt = false;
if (Ui::CheckboxWithHint(TEXT("Player.SprintEverywhere"), &sprintInt, TEXT("Player.SprintEverywhereTip")))
{
if (sprintInt)
{
patch::SetRaw(0x688610, (char*)"\x90\x90", 2);
}
else
{
patch::SetRaw(0x688610, (char*)"\x75\x40", 2);
}
}
#endif
2022-01-07 03:18:00 -05:00
ImGui::Columns(1);
ImGui::NewLine();
2022-02-27 14:02:11 -05:00
ImGui::TextWrapped(TEXT("Player.PlayerFlags"));
2022-01-07 03:18:00 -05:00
ImGui::Columns(2, 0, false);
bool state = BY_GAME(pPlayer->m_nPhysicalFlags.bBulletProof, pPlayer->m_nFlags.bBulletProof,
pPlayer->m_nFlags.bBulletProof);
2022-02-27 14:02:11 -05:00
if (Ui::CheckboxWithHint(TEXT("Player.BulletProof"), &state, nullptr, m_bGodMode))
2022-01-07 03:18:00 -05:00
{
BY_GAME(pPlayer->m_nPhysicalFlags.bBulletProof, pPlayer->m_nFlags.bBulletProof,
pPlayer->m_nFlags.bBulletProof) = state;
2022-01-07 03:18:00 -05:00
}
state = BY_GAME(pPlayer->m_nPhysicalFlags.bCollisionProof, pPlayer->m_nFlags.bCollisionProof,
pPlayer->m_nFlags.bCollisionProof);
2022-02-27 14:02:11 -05:00
if (Ui::CheckboxWithHint(TEXT("Player.CollisionProof"), &state, nullptr, m_bGodMode))
2022-01-07 03:18:00 -05:00
{
BY_GAME(pPlayer->m_nPhysicalFlags.bCollisionProof, pPlayer->m_nFlags.bCollisionProof,
pPlayer->m_nFlags.bCollisionProof) = state;
2022-01-07 03:18:00 -05:00
}
state = BY_GAME(pPlayer->m_nPhysicalFlags.bExplosionProof, pPlayer->m_nFlags.bExplosionProof,
pPlayer->m_nFlags.bExplosionProof);
2022-02-27 14:02:11 -05:00
if (Ui::CheckboxWithHint(TEXT("Player.ExplosionProof"), &state, nullptr, m_bGodMode))
2022-01-07 03:18:00 -05:00
{
BY_GAME(pPlayer->m_nPhysicalFlags.bExplosionProof, pPlayer->m_nFlags.bExplosionProof,
pPlayer->m_nFlags.bExplosionProof) = state;
2022-01-07 03:18:00 -05:00
}
ImGui::NextColumn();
state = BY_GAME(pPlayer->m_nPhysicalFlags.bFireProof, pPlayer->m_nFlags.bFireProof,
pPlayer->m_nFlags.bFireProof);
2022-02-27 14:02:11 -05:00
if (Ui::CheckboxWithHint(TEXT("Player.FireProof"), &state, nullptr, m_bGodMode))
2022-01-07 03:18:00 -05:00
{
BY_GAME(pPlayer->m_nPhysicalFlags.bFireProof, pPlayer->m_nFlags.bFireProof,
pPlayer->m_nFlags.bFireProof) = state;
2022-01-07 03:18:00 -05:00
}
state = BY_GAME(pPlayer->m_nPhysicalFlags.bMeleeProof, pPlayer->m_nFlags.bMeleeProof,
pPlayer->m_nFlags.bMeleeProof);
2022-02-27 14:02:11 -05:00
if (Ui::CheckboxWithHint(TEXT("Player.MeeleProof"), &state, nullptr, m_bGodMode))
2022-01-07 03:18:00 -05:00
{
BY_GAME(pPlayer->m_nPhysicalFlags.bMeleeProof, pPlayer->m_nFlags.bMeleeProof,
pPlayer->m_nFlags.bMeleeProof) = state;
2022-01-07 03:18:00 -05:00
}
ImGui::EndChild();
ImGui::EndTabItem();
}
2022-02-27 14:02:11 -05:00
if (ImGui::BeginTabItem(TEXT("Window.MenusTab")))
2022-01-07 03:18:00 -05:00
{
ImGui::BeginChild("PlayerMenus");
2022-03-09 17:23:08 -05:00
Ui::EditReference(TEXT("Player.Armour"), pPlayer->m_fArmour, 0, 100, BY_GAME(pInfo->m_nMaxArmour, pInfo->m_nMaxArmour, 100));
2021-08-06 11:53:18 -04:00
#ifdef GTASA
2022-02-27 14:02:11 -05:00
if (ImGui::CollapsingHeader(TEXT("Player.Body")))
2022-01-07 03:18:00 -05:00
{
if (pPlayer->m_nModelIndex == 0)
{
ImGui::Columns(3, 0, false);
2022-06-28 16:23:03 -04:00
static int bodyState = 0;
if (ImGui::RadioButton(TEXT("Player.Fat"), &bodyState, 2))
2022-02-27 14:02:11 -05:00
{
2022-01-07 03:18:00 -05:00
CCheat::FatCheat();
2022-02-27 14:02:11 -05:00
}
2022-01-07 03:18:00 -05:00
ImGui::NextColumn();
2022-06-28 16:23:03 -04:00
if (ImGui::RadioButton(TEXT("Player.Muscle"), &bodyState, 1))
2022-02-27 14:02:11 -05:00
{
2022-01-07 03:18:00 -05:00
CCheat::MuscleCheat();
2022-02-27 14:02:11 -05:00
}
2022-01-07 03:18:00 -05:00
ImGui::NextColumn();
2022-06-28 16:23:03 -04:00
if (ImGui::RadioButton(TEXT("Player.Skinny"), &bodyState, 0))
2022-02-27 14:02:11 -05:00
{
2022-01-07 03:18:00 -05:00
CCheat::SkinnyCheat();
2022-02-27 14:02:11 -05:00
}
2022-01-07 03:18:00 -05:00
ImGui::Columns(1);
}
else
{
2022-02-27 14:02:11 -05:00
ImGui::TextWrapped(TEXT("Player.NeedCJSkin"));
2022-01-07 03:18:00 -05:00
ImGui::Spacing();
2022-02-27 14:02:11 -05:00
if (ImGui::Button(TEXT("Player.ChangeToCJ"), ImVec2(Ui::GetSize(1))))
2022-01-07 03:18:00 -05:00
{
pPlayer->SetModelIndex(0);
Util::ClearCharTasksVehCheck(pPlayer);
}
}
ImGui::Spacing();
ImGui::Separator();
}
2022-02-27 14:02:11 -05:00
Ui::EditStat(TEXT("Player.Energy"), STAT_ENERGY);
Ui::EditStat(TEXT("Player.Fat"), STAT_FAT);
2021-08-06 11:53:18 -04:00
#endif
2022-02-27 14:02:11 -05:00
Ui::EditReference(TEXT("Player.Health"), pPlayer->m_fHealth, 0, 100, BY_GAME(static_cast<int>(pPlayer->m_fMaxHealth), 100, 100));
2021-08-06 11:53:18 -04:00
#ifdef GTASA
2022-02-27 14:02:11 -05:00
Ui::EditStat(TEXT("Player.LungCapacity"), STAT_LUNG_CAPACITY);
2022-03-02 14:55:04 -05:00
Ui::EditReference(TEXT("Player.MaxArmour"), pInfo->m_nMaxArmour, 0, 100, 255);
2022-02-27 14:02:11 -05:00
Ui::EditStat(TEXT("Player.MaxHealth"), STAT_MAX_HEALTH, 0, 569, 1450);
Ui::EditAddress<int>(TEXT("Player.Money"), 0xB7CE50, -99999999, 0, 99999999);
2022-01-07 03:18:00 -05:00
#else
int money = pInfo->m_nMoney;
2022-02-27 14:02:11 -05:00
Ui::EditAddress<int>(TEXT("Player.Money"), (int)&money, -9999999, 0, 99999999);
2022-01-07 03:18:00 -05:00
pInfo->m_nMoney = money;
pInfo->m_nDisplayMoney = money;
2021-08-06 11:53:18 -04:00
#endif
2022-01-07 03:18:00 -05:00
2021-08-06 11:53:18 -04:00
#ifdef GTASA
2022-02-27 14:02:11 -05:00
Ui::EditStat(TEXT("Player.Muscle"), STAT_MUSCLE);
Ui::EditStat(TEXT("Player.Respect"), STAT_RESPECT);
Ui::EditStat(TEXT("Player.Stamina"), STAT_STAMINA);
if (ImGui::CollapsingHeader(TEXT("Player.TopDownCamera")))
2022-01-07 03:18:00 -05:00
{
2022-06-26 08:08:55 -04:00
if (ImGui::Checkbox(TEXT("Window.Enabled"), &TopDownCamera::m_bEnabled))
2022-01-07 03:18:00 -05:00
{
Command<Commands::RESTORE_CAMERA_JUMPCUT>();
}
ImGui::Spacing();
2022-06-26 08:08:55 -04:00
ImGui::SliderFloat(TEXT("Player.CameraZoom"), &TopDownCamera::m_fOffset, 20.0f, 60.0f);
2022-01-07 03:18:00 -05:00
ImGui::Spacing();
ImGui::Separator();
}
2021-08-06 11:53:18 -04:00
#endif
2022-02-27 14:02:11 -05:00
if (ImGui::CollapsingHeader(TEXT("Player.WantedLevel")))
2022-01-07 03:18:00 -05:00
{
2021-08-06 11:53:18 -04:00
#ifdef GTASA
2022-01-07 03:18:00 -05:00
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;
#else
int val = pPlayer->m_pWanted->m_nWantedLevel;
int max_wl = 6;
2021-08-06 11:53:18 -04:00
#endif
2020-12-02 16:19:16 -05:00
2022-01-07 03:18:00 -05:00
ImGui::Columns(3, 0, false);
2022-02-27 14:02:11 -05:00
ImGui::Text("%s: 0", TEXT("Window.Minimum"));
2022-01-07 03:18:00 -05:00
ImGui::NextColumn();
2022-02-27 14:02:11 -05:00
ImGui::Text("%s: 0", TEXT("Window.Default"));
2022-01-07 03:18:00 -05:00
ImGui::NextColumn();
2022-02-27 14:02:11 -05:00
ImGui::Text("%s: %d", TEXT("Window.Maximum"), max_wl);
2022-01-07 03:18:00 -05:00
ImGui::Columns(1);
2020-12-02 16:19:16 -05:00
2022-01-07 03:18:00 -05:00
ImGui::Spacing();
2020-12-02 16:19:16 -05:00
2022-02-27 14:02:11 -05:00
if (ImGui::InputInt(TEXT("Window.SetValue"), &val))
2022-01-07 03:18:00 -05:00
{
2021-08-06 11:53:18 -04:00
#ifdef GTASA
2022-01-07 03:18:00 -05:00
pPlayer->CheatWantedLevel(val);
2021-08-06 11:53:18 -04:00
#elif GTAVC
2022-01-07 03:18:00 -05:00
pPlayer->m_pWanted->CheatWantedLevel(val);
#else
pPlayer->m_pWanted->SetWantedLevel(val);
2021-08-06 11:53:18 -04:00
#endif
2022-01-07 03:18:00 -05:00
}
2021-02-24 16:54:45 -05:00
2022-01-07 03:18:00 -05:00
ImGui::Spacing();
2022-02-27 14:02:11 -05:00
if (ImGui::Button(TEXT("Window.Minimum"), Ui::GetSize(3)))
2022-01-07 03:18:00 -05:00
{
2021-08-06 11:53:18 -04:00
#ifdef GTASA
2022-01-07 03:18:00 -05:00
pPlayer->CheatWantedLevel(0);
2021-08-06 11:53:18 -04:00
#elif GTAVC
2022-01-07 03:18:00 -05:00
pPlayer->m_pWanted->CheatWantedLevel(0);
#else
pPlayer->m_pWanted->SetWantedLevel(0);
2021-08-06 11:53:18 -04:00
#endif
2022-01-07 03:18:00 -05:00
}
2020-12-02 16:19:16 -05:00
2022-01-07 03:18:00 -05:00
ImGui::SameLine();
2020-12-02 16:19:16 -05:00
2022-02-27 14:02:11 -05:00
if (ImGui::Button(TEXT("Window.Default"), Ui::GetSize(3)))
2022-01-07 03:18:00 -05:00
{
2021-08-06 11:53:18 -04:00
#ifdef GTASA
2022-01-07 03:18:00 -05:00
pPlayer->CheatWantedLevel(0);
2021-08-06 11:53:18 -04:00
#elif GTAVC
2022-01-07 03:18:00 -05:00
pPlayer->m_pWanted->CheatWantedLevel(0);
#else
pPlayer->m_pWanted->SetWantedLevel(0);
2021-08-06 11:53:18 -04:00
#endif
2022-01-07 03:18:00 -05:00
}
2020-12-02 16:19:16 -05:00
2022-01-07 03:18:00 -05:00
ImGui::SameLine();
2020-12-02 16:19:16 -05:00
2022-02-27 14:02:11 -05:00
if (ImGui::Button(TEXT("Window.Maximum"), Ui::GetSize(3)))
2022-01-07 03:18:00 -05:00
{
2021-08-06 11:53:18 -04:00
#ifdef GTASA
2022-01-07 03:18:00 -05:00
pPlayer->CheatWantedLevel(max_wl);
2021-08-06 11:53:18 -04:00
#elif GTAVC
2022-01-07 03:18:00 -05:00
pPlayer->m_pWanted->CheatWantedLevel(max_wl);
#else
pPlayer->m_pWanted->SetWantedLevel(max_wl);
2021-08-06 11:53:18 -04:00
#endif
2022-01-07 03:18:00 -05:00
}
2020-12-02 16:19:16 -05:00
2022-01-07 03:18:00 -05:00
ImGui::Spacing();
ImGui::Separator();
}
ImGui::EndChild();
ImGui::EndTabItem();
}
2020-12-02 16:19:16 -05:00
2021-08-06 11:53:18 -04:00
#ifdef GTASA
2022-02-27 14:02:11 -05:00
if (ImGui::BeginTabItem(TEXT("Player.AppearanceTab")))
2022-01-07 03:18:00 -05:00
{
ImGui::Spacing();
2022-02-27 14:02:11 -05:00
if (Ui::CheckboxWithHint(TEXT("Player.AimSkinChanger"), &m_bAimSkinChanger, TEXT("Player.AimSkinChangerTip") + aimSkinChanger.Pressed()))
{
2022-06-16 06:51:22 -04:00
gConfig.Set("Features.AimSkinChanger", m_bAimSkinChanger);
2022-02-27 14:02:11 -05:00
}
2022-01-07 03:18:00 -05:00
if (ImGui::BeginTabBar("AppearanceTabBar"))
{
2022-02-27 14:02:11 -05:00
if (ImGui::BeginTabItem(TEXT("Player.ClothesTab")))
2022-01-07 03:18:00 -05:00
{
if (pPlayer->m_nModelIndex == 0)
{
2022-02-27 14:02:11 -05:00
Ui::DrawImages(m_ClothData, ChangePlayerCloth, nullptr, [](std::string str)
2022-01-07 03:18:00 -05:00
{
std::stringstream ss(str);
std::string temp;
getline(ss, temp, '$');
getline(ss, temp, '$');
return temp;
}, nullptr, clothNameList, sizeof(clothNameList) / sizeof(const char*));
2022-01-07 03:18:00 -05:00
}
else
{
2022-02-27 14:02:11 -05:00
ImGui::TextWrapped(TEXT("Player.NeedCJSkin"));
2022-01-07 03:18:00 -05:00
ImGui::Spacing();
2022-02-27 14:02:11 -05:00
if (ImGui::Button(TEXT("Player.ChangeToCJ"), ImVec2(Ui::GetSize(1))))
2022-01-07 03:18:00 -05:00
{
pPlayer->SetModelIndex(0);
Util::ClearCharTasksVehCheck(pPlayer);
}
}
ImGui::EndTabItem();
}
if (pPlayer->m_nModelIndex == 0
2022-02-27 14:02:11 -05:00
&& ImGui::BeginTabItem(TEXT("Player.RemoveClothesTab")))
2022-01-07 03:18:00 -05:00
{
2022-02-27 14:02:11 -05:00
ImGui::TextWrapped(TEXT("Player.ClothesTip"));
2022-01-07 03:18:00 -05:00
ImGui::Spacing();
ImGui::BeginChild("ClothesRemove");
size_t count = 0;
2022-02-27 14:02:11 -05:00
if (ImGui::Button(TEXT("Player.RemoveAll"), ImVec2(Ui::GetSize(2))))
2022-01-07 03:18:00 -05:00
{
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 : clothNameList)
2022-01-07 03:18:00 -05:00
{
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::EndChild();
ImGui::EndTabItem();
}
2022-02-27 14:02:11 -05:00
if (ImGui::BeginTabItem(TEXT("Player.PedSkinsTab")))
2022-01-07 03:18:00 -05:00
{
Ui::DrawImages(Ped::m_PedData, ChangePlayerModel, nullptr,
[](std::string str)
{
2022-06-15 06:45:43 -04:00
return Ped::m_PedData.m_pData->Get(str.c_str(), "Unknown");
2022-01-07 03:18:00 -05:00
});
ImGui::EndTabItem();
}
2022-02-27 14:02:11 -05:00
if (ImGui::BeginTabItem(TEXT("Player.CustomSkinsTab")))
2022-01-07 03:18:00 -05:00
{
ImGui::Spacing();
if (m_bModloaderInstalled)
{
2022-02-27 14:02:11 -05:00
Ui::FilterWithHint(TEXT("Window.Search"), m_ClothData.m_Filter,
2022-06-26 08:08:55 -04:00
std::string(TEXT("Player.TotalSkins") + std::to_string(CustomSkins::m_List.size()))
2022-01-07 03:18:00 -05:00
.c_str());
2022-02-27 14:02:11 -05:00
Ui::ShowTooltip(TEXT("Player.CustomSkinsDirTip"));
2022-01-07 03:18:00 -05:00
ImGui::Spacing();
2022-02-27 14:02:11 -05:00
ImGui::TextWrapped(TEXT("Player.CustomSkinsTip"));
2022-01-07 03:18:00 -05:00
ImGui::Spacing();
2022-06-26 08:08:55 -04:00
for (std::string name : CustomSkins::m_List)
2022-01-07 03:18:00 -05:00
{
2022-06-26 08:08:55 -04:00
if (CustomSkins::m_Filter.PassFilter(name.c_str()))
2022-01-07 03:18:00 -05:00
{
if (ImGui::MenuItem(name.c_str()))
{
ChangePlayerModel(name);
}
}
}
}
else
{
2022-02-27 14:02:11 -05:00
ImGui::TextWrapped(TEXT("Player.CustomSkinTutorial"));
2022-01-07 03:18:00 -05:00
ImGui::Spacing();
2022-02-27 14:02:11 -05:00
if (ImGui::Button(TEXT("Player.DownloadModloader"), ImVec2(Ui::GetSize(1))))
2022-01-07 03:18:00 -05:00
ShellExecute(NULL, "open", "https://gtaforums.com/topic/669520-mod-loader/", NULL, NULL,
SW_SHOWNORMAL);
}
ImGui::EndTabItem();
}
ImGui::EndTabBar();
}
ImGui::EndTabItem();
}
#else
2022-02-27 14:02:11 -05:00
if (ImGui::BeginTabItem(TEXT("Player.SkinsTab")))
2022-01-07 03:18:00 -05:00
{
ImGui::Spacing();
2021-10-22 18:03:27 -04:00
#ifdef GTA3
2022-02-27 14:02:11 -05:00
ImGui::TextWrapped(TEXT("Player.SkinChangeFrozen"));
CPad::GetPad(0)->DisablePlayerControls = true;
2021-10-22 18:03:27 -04:00
#else
2022-02-27 14:02:11 -05:00
ImGui::TextWrapped(TEXT("Player.WorkSkinOnly"));
2021-10-22 18:03:27 -04:00
#endif
2022-06-26 08:21:28 -04:00
Ui::DrawList(skinData, ChangePlayerModel, nullptr);
2022-01-07 03:18:00 -05:00
ImGui::EndTabItem();
}
2021-08-06 11:53:18 -04:00
#endif
2022-01-07 03:18:00 -05:00
ImGui::EndTabBar();
}
2020-12-02 16:19:16 -05:00
}