diff --git a/src/menu.cpp b/src/menu.cpp index dfc6c8d..ebadf36 100644 --- a/src/menu.cpp +++ b/src/menu.cpp @@ -27,6 +27,11 @@ Menu::Menu() m_Overlay::mSelectedPos = (DISPLAY_POS)gConfig.GetValue("overlay.selected_pos", (int)DISPLAY_POS::BOTTOM_RIGHT); m_Overlay::fPosX = gConfig.GetValue("overlay.pox", 0); m_Overlay::fPosY = gConfig.GetValue("overlay.posy", 0); + m_Overlay::textColor[0] = gConfig.GetValue("overlay.text_color.r", 1.0f); + m_Overlay::textColor[1] = gConfig.GetValue("overlay.text_color.g", 1.0f); + m_Overlay::textColor[2] = gConfig.GetValue("overlay.text_color.b", 1.0f); + m_Overlay::textColor[3] = gConfig.GetValue("overlay.text_color.a", 1.0f); + // Hotkeys aimSkinChanger.m_key1 = gConfig.GetValue("hotkey.aim_skin_changer.key1", VK_RETURN); @@ -128,15 +133,15 @@ void Menu::DrawOverlay() } ImGui::SetNextWindowBgAlpha(m_Overlay::bTransparent ? 0.0f : 0.5f); - + ImGui::PushStyleColor(ImGuiCol_Text, *(ImVec4*)&m_Overlay::textColor); if (m_bShowMenu && ImGui::Begin("Overlay", nullptr, window_flags)) { CVector pos{0,0,0}; pos = pPlayer->GetPosition(); size_t game_ms = CTimer::m_snTimeInMilliseconds; - - if (game_ms - m_Overlay::mLastInterval > m_Overlay::mInterval) + static size_t interval = 0; + if (game_ms - interval > 1000) { m_Overlay::fCpuUsage = static_cast(Util::GetCurrentCPUUsage()); @@ -147,7 +152,7 @@ void Menu::DrawOverlay() m_Overlay::fMemUsage = 100.0f * (static_cast(mUsedRam) / static_cast(m_Overlay::mTotalRam)); m_Overlay::mFPS = static_cast(BY_GAME(CTimer::game_FPS, io.Framerate, io.Framerate)); - m_Overlay::mLastInterval = game_ms; + interval = game_ms; } if (m_Overlay::bCoord) @@ -195,6 +200,7 @@ void Menu::DrawOverlay() ImGui::End(); } + ImGui::PopStyleColor(); } } @@ -348,7 +354,7 @@ void Menu::Draw() if (ImGui::Button("Reset config", ImVec2(Ui::GetSize(2)))) { gConfig.m_Data.clear(); - SetHelpMessage("Config reset", false, false, false); + SetHelpMessage("Config has been reset. Restart the game for it to take effect.", false, false, false); } ImGui::SameLine(); if (ImGui::Button("Reset size", ImVec2(Ui::GetSize(2)))) @@ -365,37 +371,65 @@ void Menu::Draw() ImGui::Spacing(); ImGui::Spacing(); ImGui::SameLine(); - if (Ui::ListBox("Overlay", m_Overlay::posNames, (int&)m_Overlay::mSelectedPos)) + if (Ui::ListBox("Position", m_Overlay::posNames, (int&)m_Overlay::mSelectedPos)) + { gConfig.SetValue("overlay.selected_pos", m_Overlay::mSelectedPos); + } + + ImGui::Spacing(); + ImGui::SameLine(); + if (ImGui::ColorEdit4("Text color", m_Overlay::textColor)) + { + gConfig.SetValue("overlay.text_color.r", m_Overlay::textColor[0]); + gConfig.SetValue("overlay.text_color.g", m_Overlay::textColor[1]); + gConfig.SetValue("overlay.text_color.b", m_Overlay::textColor[2]); + gConfig.SetValue("overlay.text_color.a", m_Overlay::textColor[3]); + } ImGui::Spacing(); ImGui::Columns(2, nullptr, false); if (ImGui::Checkbox("No background", &m_Overlay::bTransparent)) + { gConfig.SetValue("overlay.transparent", m_Overlay::bTransparent); + } if (ImGui::Checkbox("Show coordinates", &m_Overlay::bCoord)) + { gConfig.SetValue("overlay.coord", m_Overlay::bCoord); + } if (ImGui::Checkbox("Show CPU usage", &m_Overlay::bCpuUsage)) + { gConfig.SetValue("overlay.cpu_usage", m_Overlay::bCpuUsage); + } if (ImGui::Checkbox("Show FPS", &m_Overlay::bFPS)) + { gConfig.SetValue("overlay.fps", m_Overlay::bFPS); + } ImGui::NextColumn(); if (ImGui::Checkbox("Show location", &m_Overlay::bLocName)) + { gConfig.SetValue("overlay.loc_name", m_Overlay::bLocName); + } if (ImGui::Checkbox("Show RAM usage", &m_Overlay::bMemUsage)) + { gConfig.SetValue("overlay.mem_usage", m_Overlay::bMemUsage); + } if (ImGui::Checkbox("Show veh health", &m_Overlay::bVehHealth)) + { gConfig.SetValue("overlay.veh_health", m_Overlay::bVehHealth); + } if (ImGui::Checkbox("Show veh speed", &m_Overlay::bVehSpeed)) + { gConfig.SetValue("overlay.veh_speed", m_Overlay::bVehSpeed); + } ImGui::Columns(1); @@ -507,6 +541,13 @@ void Menu::Draw() ImGui::Spacing(); ImGui::Separator(); } + if (ImGui::CollapsingHeader("Teleport")) + { + ImGui::Spacing(); + ImGui::TextWrapped("Teleports player to specified coordinates.\nExample: tp x y z"); + ImGui::Spacing(); + ImGui::Separator(); + } if (ImGui::CollapsingHeader("Quick vehicle spawner")) { ImGui::Spacing(); diff --git a/src/menu.h b/src/menu.h index 7b19472..f08ff34 100644 --- a/src/menu.h +++ b/src/menu.h @@ -33,9 +33,8 @@ private: static inline DISPLAY_POS mSelectedPos = DISPLAY_POS::BOTTOM_RIGHT; static inline float fPosX; static inline float fPosY; - static inline size_t mInterval = 1000; - static inline size_t mLastInterval = 0; static inline int mTotalRam = 0; + static inline float textColor[4] = {1.0f, 1.0f, 1.0f, 1.0f}; }; public: diff --git a/src/player.cpp b/src/player.cpp index 3eb3fc0..529b341 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -146,6 +146,30 @@ Player::Player() CPlayerPed* player = FindPlayerPed(); int hplayer = CPools::GetPedRef(player); + if (m_bAutoHeal) + { + 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; + } + } + if (m_KeepPosition::m_bEnabled) { if (Command(hplayer)) @@ -392,6 +416,7 @@ void Player::Draw() ImGui::BeginChild("CheckboxesChild"); ImGui::Columns(2, 0, false); + Ui::CheckboxWithHint("Auto heal", &m_bAutoHeal, "Player will heal when not taken damage for 5 seconds"); #ifdef GTASA Ui::CheckboxAddress("Bounty on yourself", 0x96913F); diff --git a/src/player.h b/src/player.h index e68b36c..eeaa41a 100644 --- a/src/player.h +++ b/src/player.h @@ -4,6 +4,7 @@ class Player { private: + static inline bool m_bAutoHeal; static inline bool m_bGodMode; static inline bool m_bModloaderInstalled; struct m_KeepPosition diff --git a/src/util.h b/src/util.h index 302765c..184e652 100644 --- a/src/util.h +++ b/src/util.h @@ -14,7 +14,7 @@ public: #ifdef GTASA static void ClearCharTasksVehCheck(CPed* ped); - static int GetLargestGangInZone(); + static int GetLargestGangInZone(); static RwTexture* LoadTextureFromMemory(char* data, unsigned int size); #endif diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 144f2ac..485b7e3 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -684,7 +684,7 @@ void Vehicle::Draw() Call<0x490EE0>(); } #endif - Ui::CheckboxWithHint("Watertight car", &m_bVehWatertight); + Ui::CheckboxWithHint("Watertight car", &m_bVehWatertight, "Peds inside won't drown if the vehicle\nis submerged in water"); Ui::CheckboxAddress("Wheels only", BY_GAME(0x96914B, 0xA10B70, 0x95CD78)); ImGui::Columns(1); diff --git a/src/visual.cpp b/src/visual.cpp index 552098e..c593906 100644 --- a/src/visual.cpp +++ b/src/visual.cpp @@ -549,7 +549,7 @@ void Visual::Draw() { #ifdef GTASA ImGui::TextWrapped( - "These options won't work if you got any mods that drastically changes the game hud. i.e. Mobile Hud, GTA 5 Hud etc."); + "These options won't work if you got any mods that drastically change the game hud. i.e. Mobile Hud, GTA 5 Hud, VHud etc."); ImGui::Spacing(); Ui::ColorPickerAddress("Armourbar color", *(int*)0x5890FC, ImVec4(225, 225, 225, 255)); Ui::EditAddress("Armourbar posX", 0x866B78, -999, 94, 999);