CheatMenuSA/CheatMenu/Menu.cpp

541 lines
17 KiB
C++
Raw Normal View History

2020-12-02 16:19:16 -05:00
#include "pch.h"
#include "MenuInfo.h"
2020-12-02 16:19:16 -05:00
#include "Menu.h"
#include "Teleport.h"
#include "Weapon.h"
#include "Vehicle.h"
#include "Ui.h"
#include "Util.h"
2021-03-10 16:10:59 -05:00
#include "Updater.h"
2020-12-02 16:19:16 -05:00
Menu::Menu()
{
2021-02-24 16:54:45 -05:00
// TODO: use structs
// Load config data
2021-06-18 12:49:11 -04:00
m_Overlay.bCoord = config.GetValue("overlay.bCoord", false);
m_Overlay.bCpuUsage = config.GetValue("overlay.bCpuUsage", false);
m_Overlay.bFPS = config.GetValue("overlay.bFPS", false);
m_Overlay.bLocName = config.GetValue("overlay.bLocName", false);
m_Overlay.bTransparent = config.GetValue("overlay.bTransparent", false);
m_Overlay.bMemUsage = config.GetValue("overlay.bMemUsage", false);
m_Overlay.bVehHealth = config.GetValue("overlay.bVehHealth", false);
m_Overlay.bVehSpeed = config.GetValue("overlay.bVehSpeed", false);
m_Overlay.mSelectedPos = (DISPLAY_POS)config.GetValue("overlay.mSelectedPos", (int)DISPLAY_POS::BOTTOM_RIGHT);
m_Overlay.fPosX = config.GetValue("overlay.fPosX", 0);
m_Overlay.fPosY = config.GetValue("overlay.fPosY", 0);
2020-12-02 16:19:16 -05:00
2021-02-24 16:54:45 -05:00
// Hotkeys
2021-06-18 12:49:11 -04:00
m_HotKeys.aimSkinChanger.m_key1 = config.GetValue("hotkey.aim_skin_changer.key1", VK_RETURN);
m_HotKeys.aimSkinChanger.m_key2 = config.GetValue("hotkey.aim_skin_changer.key2", VK_RETURN);
2020-12-02 16:19:16 -05:00
2021-06-18 12:49:11 -04:00
m_HotKeys.freeCam.m_key1 = config.GetValue("hotkey.freecam.key1", VK_F6);
m_HotKeys.freeCam.m_key2 = config.GetValue("hotkey.freecam.key2", VK_F6);
2020-12-02 16:19:16 -05:00
2021-06-18 12:49:11 -04:00
m_HotKeys.quickSceenShot.m_key1 = config.GetValue("hotkey.quick_screenshot.key1", VK_F5);
m_HotKeys.quickSceenShot.m_key2 = config.GetValue("hotkey.quick_screenshot.key2", VK_F5);
2020-12-02 16:19:16 -05:00
2021-06-18 12:49:11 -04:00
m_HotKeys.quickTeleport.m_key1 = config.GetValue("hotkey.quick_tp.key1", VK_KEY_X);
m_HotKeys.quickTeleport.m_key2 = config.GetValue("hotkey.quick_tp.key2", VK_KEY_Y);
2021-06-18 12:49:11 -04:00
m_HotKeys.menuOpen.m_key1 = config.GetValue("hotkey.menu_open.key1", VK_LCONTROL);
m_HotKeys.menuOpen.m_key2 = config.GetValue("hotkey.menu_open.key2", VK_KEY_M);
2021-06-18 12:49:11 -04:00
m_HotKeys.commandWindow.m_key1 = config.GetValue("hotkey.command_window.key1", VK_LMENU);
m_HotKeys.commandWindow.m_key2 = config.GetValue("hotkey.command_window.key2", VK_KEY_C);
2021-06-18 12:49:11 -04:00
m_HotKeys.flipVeh.m_key1 = config.GetValue("hotkey.flip_veh.key1", VK_NONE);
m_HotKeys.flipVeh.m_key2 = config.GetValue("hotkey.flip_veh.key2", VK_NONE);
2021-06-18 12:49:11 -04:00
m_HotKeys.fixVeh.m_key1 = config.GetValue("hotkey.fix_veh.key1", VK_NONE);
m_HotKeys.fixVeh.m_key2 = config.GetValue("hotkey.fix_veh.key2", VK_NONE);
2021-06-18 12:49:11 -04:00
m_HotKeys.godMode.m_key1 = config.GetValue("hotkey.god_mode.key1", VK_NONE);
m_HotKeys.godMode.m_key2 = config.GetValue("hotkey.god_mode.key2", VK_NONE);
2021-02-02 02:59:01 -05:00
2021-06-18 12:49:11 -04:00
m_HotKeys.vehEngine.m_key1 = config.GetValue("hotkey.veh_engine.key1", VK_NONE);
m_HotKeys.vehEngine.m_key2 = config.GetValue("hotkey.veh_engine.key2", VK_NONE);
2021-02-02 02:59:01 -05:00
2021-06-18 12:49:11 -04:00
m_HotKeys.vehInstantStart.m_key1 = config.GetValue("hotkey.veh_instant_start.key1", VK_NONE);
m_HotKeys.vehInstantStart.m_key2 = config.GetValue("hotkey.veh_instant_start.key2", VK_NONE);
2020-12-02 16:19:16 -05:00
2021-06-18 12:49:11 -04:00
m_HotKeys.vehInstantStop.m_key1 = config.GetValue("hotkey.veh_instant_stop.key1", VK_NONE);
m_HotKeys.vehInstantStop.m_key2 = config.GetValue("hotkey.veh_instant_stop.key2", VK_NONE);
Util::GetCPUUsageInit();
MEMORYSTATUSEX memInfo;
memInfo.dwLength = sizeof(MEMORYSTATUSEX);
GlobalMemoryStatusEx(&memInfo);
2021-06-18 12:49:11 -04:00
m_Overlay.mTotalRam = static_cast<int>(memInfo.ullTotalPhys * 1e-6); // Bytes -> MegaBytes
2020-12-02 16:19:16 -05:00
}
2021-02-25 17:45:41 -05:00
void Menu::DrawOverlay()
2020-12-02 16:19:16 -05:00
{
2021-02-24 16:54:45 -05:00
CPlayerPed* player = FindPlayerPed();
2021-06-18 12:49:11 -04:00
bool m_bShowMenu = m_Overlay.bCoord || m_Overlay.bFPS || m_Overlay.bLocName || m_Overlay.bCpuUsage || m_Overlay.bMemUsage ||
((m_Overlay.bVehHealth || m_Overlay.bVehSpeed) && player->m_pVehicle && player->m_pVehicle->IsDriver(player));
2020-12-02 16:19:16 -05:00
const float offset = 10.0f;
ImGuiIO& io = ImGui::GetIO();
2021-06-18 12:49:11 -04:00
ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_AlwaysAutoResize |
ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav;
2020-12-02 16:19:16 -05:00
2021-06-18 12:49:11 -04:00
if (m_Overlay.mSelectedPos == DISPLAY_POS::CUSTOM)
2020-12-02 16:19:16 -05:00
{
2021-06-18 12:49:11 -04:00
if (m_Overlay.fPosX != NULL && m_Overlay.fPosY != NULL)
{
config.SetValue("overlay.fPosX", m_Overlay.fPosX);
config.SetValue("overlay.fPosY", m_Overlay.fPosY);
ImGui::SetNextWindowPos(ImVec2(m_Overlay.fPosX, m_Overlay.fPosY), ImGuiCond_Once);
}
2020-12-02 16:19:16 -05:00
}
else
{
2021-06-18 12:49:11 -04:00
window_flags |= ImGuiWindowFlags_NoMove;
ImVec2 pos, pivot;
if (m_Overlay.mSelectedPos == DISPLAY_POS::TOP_LEFT)
{
pos = ImVec2(offset, offset);
pivot = ImVec2(0.0f, 0.0f);
}
if (m_Overlay.mSelectedPos == DISPLAY_POS::TOP_RIGHT)
{
pos = ImVec2(io.DisplaySize.x - offset, offset);
pivot = ImVec2(1.0f, 0.0f);
}
if (m_Overlay.mSelectedPos == DISPLAY_POS::BOTTOM_LEFT)
{
pos = ImVec2(offset, io.DisplaySize.y - offset);
pivot = ImVec2(0.0f, 1.0f);
}
if (m_Overlay.mSelectedPos == DISPLAY_POS::BOTTOM_RIGHT)
{
2021-06-18 12:49:11 -04:00
pos = ImVec2(io.DisplaySize.x - offset, io.DisplaySize.y - offset);
pivot = ImVec2(1.0f, 1.0f);
}
2021-06-18 12:49:11 -04:00
ImGui::SetNextWindowPos(pos, ImGuiCond_Always, pivot);
2020-12-02 16:19:16 -05:00
}
2021-06-18 12:49:11 -04:00
ImGui::SetNextWindowBgAlpha(m_Overlay.bTransparent ? 0.0f : 0.5f);
2020-12-02 16:19:16 -05:00
2021-06-18 12:49:11 -04:00
if (m_bShowMenu && ImGui::Begin("Overlay", nullptr, window_flags))
2020-12-02 16:19:16 -05:00
{
2021-02-24 16:54:45 -05:00
CPlayerPed* player = FindPlayerPed();
CVector pos = player->GetPosition();
size_t game_ms = CTimer::m_snTimeInMilliseconds;
2021-02-24 16:54:45 -05:00
2021-06-18 12:49:11 -04:00
if (game_ms - m_Overlay.mLastInterval > m_Overlay.mInterval)
2020-12-02 16:19:16 -05:00
{
2021-06-18 12:49:11 -04:00
m_Overlay.fCpuUsage = static_cast<float>(Util::GetCurrentCPUUsage());
2020-12-02 16:19:16 -05:00
MEMORYSTATUSEX memInfo;
memInfo.dwLength = sizeof(MEMORYSTATUSEX);
GlobalMemoryStatusEx(&memInfo);
2021-06-18 12:49:11 -04:00
int mUsedRam = static_cast<int>((memInfo.ullTotalPhys - memInfo.ullAvailPhys) * 1e-6);
m_Overlay.fMemUsage = 100.0f * (static_cast<float>(mUsedRam) / static_cast<float>(m_Overlay.mTotalRam));
m_Overlay.mFPS = static_cast<size_t>(CTimer::game_FPS);
2020-12-02 16:19:16 -05:00
2021-06-18 12:49:11 -04:00
m_Overlay.mLastInterval = game_ms;
2020-12-02 16:19:16 -05:00
}
2021-06-18 12:49:11 -04:00
if (m_Overlay.bCoord)
ImGui::Text("Coord: %.2f, %.2f, %.2f", pos.x, pos.y, pos.z);
2021-06-18 12:49:11 -04:00
if (m_Overlay.bCpuUsage)
ImGui::Text("CPU usage: %.2f%%", m_Overlay.fCpuUsage);
2021-06-18 12:49:11 -04:00
if (m_Overlay.bFPS)
ImGui::Text("Frames: %d", m_Overlay.mFPS);
2020-12-02 16:19:16 -05:00
2021-06-18 12:49:11 -04:00
if (m_Overlay.bLocName)
ImGui::Text("Location: %s", Util::GetLocationName(&pos).c_str());
2021-06-18 12:49:11 -04:00
if (m_Overlay.bMemUsage)
ImGui::Text("RAM usage: %.2f%%", m_Overlay.fMemUsage);
2020-12-02 16:19:16 -05:00
if (player->m_pVehicle && player->m_pVehicle->IsDriver(player))
{
2021-06-18 12:49:11 -04:00
if (m_Overlay.bVehHealth)
ImGui::Text("Veh Health: %.f", player->m_pVehicle->m_fHealth);
2020-12-02 16:19:16 -05:00
2021-06-18 12:49:11 -04:00
if (m_Overlay.bVehSpeed)
ImGui::Text("Veh Speed: %d", int(player->m_pVehicle->m_vecMoveSpeed.Magnitude()) * 50); // 02E3 - GET_CAR_SPEED
2020-12-02 16:19:16 -05:00
}
ImVec2 windowPos = ImGui::GetWindowPos();
2021-06-18 12:49:11 -04:00
m_Overlay.fPosX = windowPos.x;
m_Overlay.fPosY = windowPos.y;
2020-12-02 16:19:16 -05:00
ImGui::End();
}
}
2021-02-24 16:54:45 -05:00
void Menu::DrawShortcutsWindow()
2020-12-02 16:19:16 -05:00
{
2021-06-18 12:49:11 -04:00
int resX = static_cast<int>(screen::GetScreenWidth());
int resY = static_cast<int>(screen::GetScreenHeight());
2020-12-02 16:19:16 -05:00
2021-02-24 16:54:45 -05:00
ImGui::SetNextWindowPos(ImVec2(0, resY - 40), ImGuiCond_Always);
ImGui::SetNextWindowSize(ImVec2(resX, 40));
2020-12-02 16:19:16 -05:00
2021-06-18 12:49:11 -04:00
ImGuiWindowFlags flags = ImGuiWindowFlags_NoDecoration + ImGuiWindowFlags_AlwaysAutoResize +
ImGuiWindowFlags_NoSavedSettings
2021-02-24 16:54:45 -05:00
+ ImGuiWindowFlags_NoMove;
2020-12-02 16:19:16 -05:00
2021-06-18 12:49:11 -04:00
if (ImGui::Begin("Shortcuts window", nullptr, flags))
2021-02-24 16:54:45 -05:00
{
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(ImGui::GetStyle().FramePadding.x, resY / 130));
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(3, 3));
2020-12-02 16:19:16 -05:00
2021-02-24 16:54:45 -05:00
ImGui::SetNextItemWidth(resX);
ImGui::SetKeyboardFocusHere(-1);
2021-06-18 12:49:11 -04:00
if (ImGui::InputTextWithHint("##TEXTFIELD", "Enter command", m_Commands.m_nInputBuffer, INPUT_BUFFER_SIZE,
ImGuiInputTextFlags_EnterReturnsTrue))
2021-02-24 16:54:45 -05:00
{
ProcessCommands();
2021-06-18 12:49:11 -04:00
m_Commands.m_bShowMenu = false;
strcpy(m_Commands.m_nInputBuffer, "");
2020-12-02 16:19:16 -05:00
}
2021-02-24 16:54:45 -05:00
ImGui::PopStyleVar(2);
ImGui::End();
}
2020-12-02 16:19:16 -05:00
}
void Menu::ProcessCommands()
{
2021-06-18 12:49:11 -04:00
std::stringstream ss(m_Commands.m_nInputBuffer);
2020-12-02 16:19:16 -05:00
std::string command;
ss >> command;
if (command == "hp")
{
try
{
std::string temp;
ss >> temp;
FindPlayerPed()->m_fHealth = std::stof(temp);
}
2021-06-18 12:49:11 -04:00
catch (...)
{
2020-12-02 16:19:16 -05:00
CHud::SetHelpMessage("Invalid value", false, false, false);
}
}
if (command == "time")
{
2021-02-24 16:54:45 -05:00
try
2020-12-02 16:19:16 -05:00
{
std::string temp;
ss >> temp;
CClock::ms_nGameClockHours = std::stoi(temp);
ss >> temp;
CClock::ms_nGameClockMinutes = std::stoi(temp);
}
2021-06-18 12:49:11 -04:00
catch (...)
{
2020-12-02 16:19:16 -05:00
CHud::SetHelpMessage("Invalid value", false, false, false);
}
}
if (command == "tp")
{
2021-06-18 12:49:11 -04:00
try
{
2020-12-02 16:19:16 -05:00
CVector pos;
std::string temp;
ss >> temp;
pos.x = std::stof(temp);
ss >> temp;
pos.y = std::stof(temp);
ss >> temp;
pos.z = std::stof(temp);
Teleport::TeleportPlayer(false, pos, 0);
2020-12-02 16:19:16 -05:00
}
2021-06-18 12:49:11 -04:00
catch (...)
{
2020-12-02 16:19:16 -05:00
CHud::SetHelpMessage("Invalid location", false, false, false);
}
}
if (command == "wep")
2021-02-24 16:54:45 -05:00
{
2020-12-02 16:19:16 -05:00
std::string wep_name;
ss >> wep_name;
if (wep_name == "jetpack")
{
std::string weapon = "-1";
Weapon::GiveWeaponToPlayer(weapon);
2020-12-02 16:19:16 -05:00
CHud::SetHelpMessage("Weapon given", false, false, false);
}
else
{
eWeaponType weapon = CWeaponInfo::FindWeaponType((char*)wep_name.c_str());
std::string weapon_name = std::to_string(weapon);
2020-12-02 16:19:16 -05:00
CWeaponInfo* pweaponinfo = CWeaponInfo::GetWeaponInfo(weapon, 1);
if (wep_name != "" && pweaponinfo->m_nModelId1 != -1)
{
Weapon::GiveWeaponToPlayer(weapon_name);
2020-12-02 16:19:16 -05:00
CHud::SetHelpMessage("Weapon given", false, false, false);
}
else
CHud::SetHelpMessage("Invalid command", false, false, false);
}
2021-02-24 16:54:45 -05:00
return;
}
if (command == "veh")
2021-02-24 16:54:45 -05:00
{
std::string veh_name;
ss >> veh_name;
2021-02-24 16:54:45 -05:00
int model = Vehicle::GetModelFromName(veh_name.c_str());
if (model != 0)
{
std::string smodel = std::to_string(model);
Vehicle::SpawnVehicle(smodel);
CHud::SetHelpMessage("Vehicle spawned", false, false, false);
}
else
CHud::SetHelpMessage("Invalid command", false, false, false);
2020-12-02 16:19:16 -05:00
}
}
2021-02-24 16:54:45 -05:00
void Menu::Draw()
2020-12-02 16:19:16 -05:00
{
if (ImGui::BeginTabBar("Menu", ImGuiTabBarFlags_NoTooltip + ImGuiTabBarFlags_FittingPolicyScroll))
{
if (ImGui::BeginTabItem("Overlay"))
{
ImGui::Spacing();
ImGui::Spacing();
ImGui::SameLine();
2021-06-18 12:49:11 -04:00
if (Ui::ListBox("Overlay", m_Overlay.posNames, (int&)m_Overlay.mSelectedPos))
config.SetValue("overlay.mSelectedPos", m_Overlay.mSelectedPos);
2020-12-02 16:19:16 -05:00
ImGui::Spacing();
2021-06-18 12:49:11 -04:00
ImGui::Columns(2, nullptr, false);
if (ImGui::Checkbox("No background", &m_Overlay.bTransparent))
config.SetValue("overlay.bTransparent", m_Overlay.bTransparent);
2021-06-18 12:49:11 -04:00
if (ImGui::Checkbox("Show coordinates", &m_Overlay.bCoord))
config.SetValue("overlay.bCoord", m_Overlay.bCoord);
2021-06-18 12:49:11 -04:00
if (ImGui::Checkbox("Show CPU usage", &m_Overlay.bCpuUsage))
config.SetValue("overlay.bCpuUsage", m_Overlay.bCpuUsage);
2021-06-18 12:49:11 -04:00
if (ImGui::Checkbox("Show FPS", &m_Overlay.bFPS))
config.SetValue("overlay.bFPS", m_Overlay.bFPS);
2020-12-02 16:19:16 -05:00
ImGui::NextColumn();
2021-06-18 12:49:11 -04:00
if (ImGui::Checkbox("Show location", &m_Overlay.bLocName))
config.SetValue("overlay.bLocName", m_Overlay.bLocName);
2021-06-18 12:49:11 -04:00
if (ImGui::Checkbox("Show RAM usage", &m_Overlay.bMemUsage))
config.SetValue("overlay.bMemUsage", m_Overlay.bMemUsage);
2021-06-18 12:49:11 -04:00
if (ImGui::Checkbox("Show veh health", &m_Overlay.bVehHealth))
config.SetValue("overlay.bVehHealth", m_Overlay.bVehHealth);
2021-06-18 12:49:11 -04:00
if (ImGui::Checkbox("Show veh speed", &m_Overlay.bVehSpeed))
config.SetValue("overlay.bVehSpeed", m_Overlay.bVehSpeed);
2020-12-02 16:19:16 -05:00
ImGui::Columns(1);
2021-02-24 16:54:45 -05:00
2020-12-02 16:19:16 -05:00
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Hotkeys"))
{
ImGui::Spacing();
2021-02-10 09:47:35 -05:00
ImGui::Text("Usage");
Ui::ShowTooltip("Left-click selects hotkey.\nLeft clicking outside deselects."
2021-06-18 12:49:11 -04:00
"\nRight click disables hotkey.");
2020-12-02 16:19:16 -05:00
ImGui::Spacing();
ImGui::BeginChild("Hotkeys");
2021-06-18 12:49:11 -04:00
if (Ui::HotKey("Open/ close cheat menu", m_HotKeys.menuOpen))
{
2021-06-18 12:49:11 -04:00
config.SetValue("hotkey.menu_open.key1", m_HotKeys.menuOpen.m_key1);
config.SetValue("hotkey.menu_open.key2", m_HotKeys.menuOpen.m_key2);
}
2021-06-18 12:49:11 -04:00
if (Ui::HotKey("Open/ close command window", m_HotKeys.commandWindow))
{
2021-06-18 12:49:11 -04:00
config.SetValue("hotkey.command_window.key1", m_HotKeys.commandWindow.m_key1);
config.SetValue("hotkey.command_window.key2", m_HotKeys.commandWindow.m_key2);
}
2020-12-02 16:19:16 -05:00
2021-02-24 16:54:45 -05:00
ImGui::Dummy(ImVec2(0, 10));
2020-12-02 16:19:16 -05:00
2021-06-18 12:49:11 -04:00
if (Ui::HotKey("Activate aim skin changer", m_HotKeys.aimSkinChanger))
{
2021-06-18 12:49:11 -04:00
config.SetValue("hotkey.aim_skin_changer.key1", m_HotKeys.aimSkinChanger.m_key1);
config.SetValue("hotkey.aim_skin_changer.key2", m_HotKeys.aimSkinChanger.m_key2);
}
2021-06-18 12:49:11 -04:00
if (Ui::HotKey("Freecam", m_HotKeys.freeCam))
{
2021-06-18 12:49:11 -04:00
config.SetValue("hotkey.freecam.key1", m_HotKeys.freeCam.m_key1);
config.SetValue("hotkey.freecam.key2", m_HotKeys.freeCam.m_key2);
}
2021-06-18 12:49:11 -04:00
if (Ui::HotKey("Take quick screenshot", m_HotKeys.quickSceenShot))
{
2021-06-18 12:49:11 -04:00
config.SetValue("hotkey.quick_screenshot.key1", m_HotKeys.quickSceenShot.m_key1);
config.SetValue("hotkey.quick_screenshot.key2", m_HotKeys.quickSceenShot.m_key2);
}
2021-06-18 12:49:11 -04:00
if (Ui::HotKey("Toggle quick teleport", m_HotKeys.quickTeleport))
{
2021-06-18 12:49:11 -04:00
config.SetValue("hotkey.quick_tp.key1", m_HotKeys.quickTeleport.m_key1);
config.SetValue("hotkey.quick_tp.key2", m_HotKeys.quickTeleport.m_key2);
}
2020-12-02 16:19:16 -05:00
2021-02-24 16:54:45 -05:00
ImGui::Dummy(ImVec2(0, 10));
2021-06-18 12:49:11 -04:00
if (Ui::HotKey("Fix current vehicle", m_HotKeys.fixVeh))
{
2021-06-18 12:49:11 -04:00
config.SetValue("hotkey.fix_veh.key1", m_HotKeys.fixVeh.m_key1);
config.SetValue("hotkey.fix_veh.key2", m_HotKeys.fixVeh.m_key2);
}
2021-06-18 12:49:11 -04:00
if (Ui::HotKey("Flip current vehicle", m_HotKeys.flipVeh))
{
2021-06-18 12:49:11 -04:00
config.SetValue("hotkey.flip_veh.key1", m_HotKeys.flipVeh.m_key1);
config.SetValue("hotkey.flip_veh.key2", m_HotKeys.flipVeh.m_key2);
}
2021-06-18 12:49:11 -04:00
if (Ui::HotKey("Toggle god mode", m_HotKeys.godMode))
{
2021-06-18 12:49:11 -04:00
config.SetValue("hotkey.god_mode.key1", m_HotKeys.godMode.m_key1);
config.SetValue("hotkey.god_mode.key2", m_HotKeys.godMode.m_key2);
}
2021-06-18 12:49:11 -04:00
if (Ui::HotKey("Toggle veh engine", m_HotKeys.vehEngine))
{
2021-06-18 12:49:11 -04:00
config.SetValue("hotkey.veh_engine.key1", m_HotKeys.vehEngine.m_key1);
config.SetValue("hotkey.veh_engine.key2", m_HotKeys.vehEngine.m_key2);
}
2021-06-18 12:49:11 -04:00
if (Ui::HotKey("Vehicle instant start", m_HotKeys.vehInstantStart))
2021-02-02 02:59:01 -05:00
{
2021-06-18 12:49:11 -04:00
config.SetValue("hotkey.veh_instant_start.key1", m_HotKeys.vehInstantStart.m_key1);
config.SetValue("hotkey.veh_instant_start.key2", m_HotKeys.vehInstantStart.m_key2);
2021-02-02 02:59:01 -05:00
}
2021-06-18 12:49:11 -04:00
if (Ui::HotKey("Vehicle instant stop", m_HotKeys.vehInstantStop))
2021-02-02 02:59:01 -05:00
{
2021-06-18 12:49:11 -04:00
config.SetValue("hotkey.veh_instant_stop.key1", m_HotKeys.vehInstantStop.m_key1);
config.SetValue("hotkey.veh_instant_stop.key2", m_HotKeys.vehInstantStop.m_key2);
2021-02-02 02:59:01 -05:00
}
2020-12-02 16:19:16 -05:00
ImGui::Dummy(ImVec2(0, 10));
ImGui::EndChild();
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Commands"))
{
if (ImGui::BeginChild("CommandsChild"))
{
2021-06-18 12:49:11 -04:00
ImGui::TextWrapped(
std::string(
"Open or close command window using " + Ui::GetHotKeyNameString(m_HotKeys.commandWindow)).
c_str());
2020-12-02 16:19:16 -05:00
ImGui::Spacing();
if (ImGui::CollapsingHeader("Set health"))
{
ImGui::Spacing();
ImGui::TextWrapped("Set player health.\nExample: hp (health).");
ImGui::Spacing();
ImGui::Separator();
}
if (ImGui::CollapsingHeader("Set time"))
{
ImGui::Spacing();
ImGui::TextWrapped("Set current game time.\nExample: time (hour) (minute).\n");
ImGui::TextWrapped("Writing something like 'time 12' would be interpreted as 'time 12 12'");
ImGui::Spacing();
ImGui::Separator();
}
if (ImGui::CollapsingHeader("Quick vehicle spawner"))
{
ImGui::Spacing();
ImGui::TextWrapped("Spawn vehicles by typing their model names.\nExample: veh (veh_name)");
ImGui::Spacing();
ImGui::Separator();
}
if (ImGui::CollapsingHeader("Quick weapon spawner"))
{
ImGui::Spacing();
ImGui::TextWrapped("Spawn weapons by typing their model names.\nExample: wep (wep_name)");
ImGui::Spacing();
ImGui::Separator();
}
ImGui::EndChild();
}
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("About"))
{
ImGui::Spacing();
2021-03-10 16:10:59 -05:00
if (ImGui::Button("Check update", ImVec2(Ui::GetSize(3))))
2021-06-18 12:49:11 -04:00
{
if (Updater::m_State == UPDATER_IDLE)
Updater::m_State = UPDATER_CHECKING;
2021-03-10 16:10:59 -05:00
}
ImGui::SameLine();
if (ImGui::Button("Discord server", ImVec2(Ui::GetSize(3))))
2021-06-18 12:49:11 -04:00
ShellExecute(nullptr, "open", DISCORD_INVITE, nullptr, nullptr, SW_SHOWNORMAL);
2020-12-02 16:19:16 -05:00
ImGui::SameLine();
2021-03-10 16:10:59 -05:00
if (ImGui::Button("GitHub repo", ImVec2(Ui::GetSize(3))))
2021-06-18 12:49:11 -04:00
ShellExecute(nullptr, "open", GITHUB_LINK, nullptr, nullptr, SW_SHOWNORMAL);
2021-02-24 16:54:45 -05:00
2020-12-02 16:19:16 -05:00
ImGui::Spacing();
if (ImGui::BeginChild("AboutChild"))
{
2021-06-18 12:49:11 -04:00
ImGui::Columns(2, nullptr, false);
2020-12-02 16:19:16 -05:00
ImGui::Text("Author: Grinch_");
2021-06-15 13:11:11 -04:00
ImGui::Text("Version: %s",MENU_VERSION);
2020-12-02 16:19:16 -05:00
ImGui::NextColumn();
2021-06-15 13:11:11 -04:00
ImGui::Text("ImGui: %s", ImGui::GetVersion());
ImGui::Text("Build: %s", BUILD_NUMBER);
2020-12-02 16:19:16 -05:00
ImGui::Columns(1);
2021-02-24 16:54:45 -05:00
2020-12-02 16:19:16 -05:00
ImGui::Dummy(ImVec2(0, 10));
ImGui::TextWrapped("If you find bugs or have suggestions, let me know on discord.");
ImGui::Dummy(ImVec2(0, 10));
ImGui::TextWrapped("Thanks to Junior-Djjr");
2020-12-02 16:19:16 -05:00
ImGui::Dummy(ImVec2(0, 10));
Ui::CenterdText("Copyright GPLv3 2019-2021 Grinch_");
2021-02-24 16:54:45 -05:00
2020-12-02 16:19:16 -05:00
ImGui::EndChild();
}
ImGui::EndTabItem();
}
ImGui::EndTabBar();
}
2021-06-18 12:49:11 -04:00
}