mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2024-12-22 20:17:24 +08:00
Move Collapsing Headers in Weapons to Separate Tab (#3627)
This commit is contained in:
parent
351749e598
commit
0d26223bfe
@ -11,7 +11,7 @@ command.call_player(somePlayerIndex, "spawn", {joaat("adder")})
|
|||||||
|
|
||||||
For a complete list of available command functions, please refer to the command table documentation.
|
For a complete list of available command functions, please refer to the command table documentation.
|
||||||
|
|
||||||
## Command Count: 209
|
## Command Count: 210
|
||||||
|
|
||||||
### breakup
|
### breakup
|
||||||
BREAKUP_KICK_DESC
|
BREAKUP_KICK_DESC
|
||||||
@ -849,3 +849,6 @@ Arg Count: 0
|
|||||||
Toggles the command executor window
|
Toggles the command executor window
|
||||||
Arg Count: 0
|
Arg Count: 0
|
||||||
|
|
||||||
|
### resetweaps
|
||||||
|
Resets your weapon loadout to default.
|
||||||
|
Arg Count: 0
|
@ -207,3 +207,4 @@
|
|||||||
[20:46:19.5971135][INFO/command.cpp:48] Command | player_db_auto_update_states | Auto Update Player Online States | Toggling this feature will automatically update the player online states every 5minutes. | 0
|
[20:46:19.5971135][INFO/command.cpp:48] Command | player_db_auto_update_states | Auto Update Player Online States | Toggling this feature will automatically update the player online states every 5minutes. | 0
|
||||||
[20:46:19.5971390][INFO/command.cpp:48] Command | vehiclecontrol | Vehicle controller | Enables/Disables the vehicle controller. | 0
|
[20:46:19.5971390][INFO/command.cpp:48] Command | vehiclecontrol | Vehicle controller | Enables/Disables the vehicle controller. | 0
|
||||||
[20:46:19.5972044][INFO/command.cpp:48] Command | cmdexecutor | Toggle Command Executor | Toggles the command executor window | 0
|
[20:46:19.5972044][INFO/command.cpp:48] Command | cmdexecutor | Toggle Command Executor | Toggles the command executor window | 0
|
||||||
|
[20:46:19.5972044][INFO/command.cpp:48] Command | resetweaps | Reset Weapons | Resets your weapon loadout to default. | 0
|
||||||
|
@ -13,10 +13,11 @@ end)
|
|||||||
|
|
||||||
For a complete list of available gui functions, please refer to the tab class documentation and the gui table documentation.
|
For a complete list of available gui functions, please refer to the tab class documentation and the gui table documentation.
|
||||||
|
|
||||||
## Tab Count: 49
|
## Tab Count: 50
|
||||||
|
|
||||||
### `GUI_TAB_SELF`
|
### `GUI_TAB_SELF`
|
||||||
### `GUI_TAB_WEAPONS`
|
### `GUI_TAB_WEAPONS`
|
||||||
|
### `GUI_TAB_WEAPONS_AMMUNATION`
|
||||||
### `GUI_TAB_TELEPORT`
|
### `GUI_TAB_TELEPORT`
|
||||||
### `GUI_TAB_CUSTOM_TELEPORT`
|
### `GUI_TAB_CUSTOM_TELEPORT`
|
||||||
### `GUI_TAB_MOBILE`
|
### `GUI_TAB_MOBILE`
|
||||||
|
21
src/backend/commands/self/reset_weapons.cpp
Normal file
21
src/backend/commands/self/reset_weapons.cpp
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
#include "backend/command.hpp"
|
||||||
|
#include "script_function.hpp"
|
||||||
|
|
||||||
|
namespace big
|
||||||
|
{
|
||||||
|
class reset_weapons : command
|
||||||
|
{
|
||||||
|
using command::command;
|
||||||
|
|
||||||
|
virtual void execute(const command_arguments&, const std::shared_ptr<command_context> ctx)
|
||||||
|
{
|
||||||
|
if (*g_pointers->m_gta.m_is_session_started && scripts::is_running("freemode"_J))
|
||||||
|
{
|
||||||
|
*scr_globals::should_reset_fm_weapons.as<PBOOL>() = TRUE;
|
||||||
|
scr_functions::give_owned_freemode_weapons.call<void>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
reset_weapons g_reset_weapons("resetweaps", "RESET_WEAPONS", "RESET_WEAPONS_DESC", 0);
|
||||||
|
}
|
@ -56,6 +56,8 @@ namespace big::scr_globals
|
|||||||
static inline const script_global gun_van(1949748); // return -29.532f, 6435.136f, 31.162f;
|
static inline const script_global gun_van(1949748); // return -29.532f, 6435.136f, 31.162f;
|
||||||
|
|
||||||
static inline const script_global disable_phone(20913);
|
static inline const script_global disable_phone(20913);
|
||||||
|
|
||||||
|
static inline const script_global should_reset_fm_weapons(1578026);
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace big::scr_locals
|
namespace big::scr_locals
|
||||||
|
@ -73,6 +73,7 @@ namespace big
|
|||||||
{
|
{
|
||||||
inline script_function set_as_ceo("SAC", "freemode"_J, "2D 04 1D 00 00 5D");
|
inline script_function set_as_ceo("SAC", "freemode"_J, "2D 04 1D 00 00 5D");
|
||||||
inline script_function set_freemode_session_active("SFSA", "freemode"_J, "2D 00 02 00 00 75 5D ? ? ? 50");
|
inline script_function set_freemode_session_active("SFSA", "freemode"_J, "2D 00 02 00 00 75 5D ? ? ? 50");
|
||||||
|
inline script_function give_owned_freemode_weapons("GOFM", "freemode"_J, "2D 00 02 00 00 62 ? ? ? 72 57 ? ? 76");
|
||||||
inline script_function save_to_datafile("STD", "fm_race_creator"_J, "2D 01 03 00 00 71 2C");
|
inline script_function save_to_datafile("STD", "fm_race_creator"_J, "2D 01 03 00 00 71 2C");
|
||||||
inline script_function load_from_datafile("LFD", "fm_race_creator"_J, "2D 03 0C 00 00 71 2C");
|
inline script_function load_from_datafile("LFD", "fm_race_creator"_J, "2D 03 0C 00 00 71 2C");
|
||||||
inline script_function reset_session_data("RSD", "main_persistent"_J, "2D 02 7D 00 00");
|
inline script_function reset_session_data("RSD", "main_persistent"_J, "2D 02 7D 00 00");
|
||||||
|
@ -10,6 +10,7 @@ namespace big
|
|||||||
|
|
||||||
SELF,
|
SELF,
|
||||||
WEAPONS,
|
WEAPONS,
|
||||||
|
WEAPONS_AMMUNATION,
|
||||||
TELEPORT,
|
TELEPORT,
|
||||||
CUSTOM_TELEPORT,
|
CUSTOM_TELEPORT,
|
||||||
MOBILE,
|
MOBILE,
|
||||||
@ -91,7 +92,14 @@ namespace big
|
|||||||
TAB_DECL(SELF),
|
TAB_DECL(SELF),
|
||||||
view::self,
|
view::self,
|
||||||
{
|
{
|
||||||
{TAB_DECL(WEAPONS), view::weapons}},
|
{
|
||||||
|
TAB_DECL(WEAPONS),
|
||||||
|
view::weapons,
|
||||||
|
{
|
||||||
|
{TAB_DECL(WEAPONS_AMMUNATION), view::ammunation}},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
{TAB_DECL(MOBILE), view::mobile}},
|
{TAB_DECL(MOBILE), view::mobile}},
|
||||||
{TAB_DECL(TELEPORT), view::teleport,
|
{TAB_DECL(TELEPORT), view::teleport,
|
||||||
{
|
{
|
||||||
|
314
src/views/self/view_ammunation.cpp
Normal file
314
src/views/self/view_ammunation.cpp
Normal file
@ -0,0 +1,314 @@
|
|||||||
|
#include "gta/weapons.hpp"
|
||||||
|
#include "services/gta_data/gta_data_service.hpp"
|
||||||
|
#include "services/persist_weapons/persist_weapons.hpp"
|
||||||
|
#include "views/view.hpp"
|
||||||
|
#include "script_mgr.hpp"
|
||||||
|
|
||||||
|
namespace big
|
||||||
|
{
|
||||||
|
bool is_weapon_mk2(Hash weapon)
|
||||||
|
{
|
||||||
|
switch (weapon)
|
||||||
|
{
|
||||||
|
case "WEAPON_PISTOL_MK2"_J:
|
||||||
|
case "WEAPON_SMG_MK2"_J:
|
||||||
|
case "WEAPON_ASSAULTRIFLE_MK2"_J:
|
||||||
|
case "WEAPON_CARBINERIFLE_MK2"_J:
|
||||||
|
case "WEAPON_COMBATMG_MK2"_J:
|
||||||
|
case "WEAPON_HEAVYSNIPER_MK2"_J:
|
||||||
|
case "WEAPON_PUMPSHOTGUN_MK2"_J:
|
||||||
|
case "WEAPON_SPECIALCARBINE_MK2"_J:
|
||||||
|
case "WEAPON_SNSPISTOL_MK2"_J:
|
||||||
|
case "WEAPON_MARKSMANRIFLE_MK2"_J:
|
||||||
|
case "WEAPON_REVOLVER_MK2"_J:
|
||||||
|
case "WEAPON_BULLPUPRIFLE_MK2"_J:
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void view::ammunation()
|
||||||
|
{
|
||||||
|
static std::string selected_weapon = "SELECT"_T.data();
|
||||||
|
static std::string selected_attachment = "SELECT"_T.data();
|
||||||
|
static Hash selected_weapon_hash = 0;
|
||||||
|
static Hash selected_attachment_hash = 0;
|
||||||
|
static int selected_tint = 0;
|
||||||
|
static char search_weapon[64];
|
||||||
|
|
||||||
|
static std::vector<std::string> default_tints;
|
||||||
|
static std::vector<std::string> mk2_tints;
|
||||||
|
if (default_tints.empty() && g_script_mgr.can_tick())
|
||||||
|
{
|
||||||
|
g_fiber_pool->queue_job([] {
|
||||||
|
for (int i = 0; i <= 7; i++)
|
||||||
|
{
|
||||||
|
std::string gxt = std::string("WM_TINT") + std::to_string(i);
|
||||||
|
std::string tint = HUD::GET_FILENAME_FOR_AUDIO_CONVERSATION(gxt.c_str());
|
||||||
|
default_tints.push_back(tint);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (mk2_tints.empty() && g_script_mgr.can_tick())
|
||||||
|
{
|
||||||
|
g_fiber_pool->queue_job([] {
|
||||||
|
for (int i = 0; i <= 31; i++)
|
||||||
|
{
|
||||||
|
std::string gxt = std::string("WCT_TINT_") + std::to_string(i);
|
||||||
|
std::string tint = HUD::GET_FILENAME_FOR_AUDIO_CONVERSATION(gxt.c_str());
|
||||||
|
mk2_tints.push_back(tint);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::BeginCombo("GUI_TAB_WEAPONS"_T.data(), selected_weapon.c_str());
|
||||||
|
if (ImGui::IsItemActive() && !ImGui::IsPopupOpen("##weapons_popup"))
|
||||||
|
{
|
||||||
|
ImGui::OpenPopup("##weapons_popup");
|
||||||
|
memset(search_weapon, 0, sizeof(search_weapon));
|
||||||
|
}
|
||||||
|
if (ImGui::BeginPopup("##weapons_popup", ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove))
|
||||||
|
{
|
||||||
|
std::map<std::string, weapon_item> sorted_map;
|
||||||
|
for (const auto& [_, weapon] : g_gta_data_service.weapons())
|
||||||
|
{
|
||||||
|
sorted_map.emplace(weapon.m_display_name, weapon);
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::Text("SEARCH"_T.data());
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::SetNextItemWidth(250.f);
|
||||||
|
components::input_text("##search_weapon", search_weapon, sizeof(search_weapon));
|
||||||
|
|
||||||
|
std::string search_lower = search_weapon;
|
||||||
|
std::transform(search_lower.begin(), search_lower.end(), search_lower.begin(), ::tolower);
|
||||||
|
|
||||||
|
bool found_match = false;
|
||||||
|
for (const auto& weapon : sorted_map)
|
||||||
|
{
|
||||||
|
auto weapon_name = weapon.second.m_display_name;
|
||||||
|
auto weapon_hash = weapon.second.m_hash;
|
||||||
|
|
||||||
|
if (weapon_name == "NULL" || weapon_hash == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
std::string weapon_lower = weapon_name;
|
||||||
|
std::transform(weapon_lower.begin(), weapon_lower.end(), weapon_lower.begin(), ::tolower);
|
||||||
|
|
||||||
|
if (weapon_lower.find(search_lower) != std::string::npos)
|
||||||
|
{
|
||||||
|
found_match = true;
|
||||||
|
if (ImGui::Selectable(weapon_name.c_str()))
|
||||||
|
{
|
||||||
|
selected_weapon = weapon_name;
|
||||||
|
selected_weapon_hash = weapon_hash;
|
||||||
|
selected_attachment = "SELECT"_T.data();
|
||||||
|
selected_attachment_hash = 0;
|
||||||
|
selected_tint = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!found_match)
|
||||||
|
ImGui::Text("NO_WEAPON_IN_REGISTRY"_T.data());
|
||||||
|
ImGui::EndPopup();
|
||||||
|
}
|
||||||
|
components::button("VIEW_WEAPON_GIVE_WEAPON"_T, [] {
|
||||||
|
WEAPON::GIVE_WEAPON_TO_PED(self::ped, selected_weapon_hash, 9999, false, true);
|
||||||
|
});
|
||||||
|
ImGui::SameLine();
|
||||||
|
components::button("VIEW_WEAPON_REMOVE_WEAPON"_T, [] {
|
||||||
|
WEAPON::REMOVE_WEAPON_FROM_PED(self::ped, selected_weapon_hash);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (ImGui::BeginCombo("VIEW_WEAPON_ATTACHMENTS"_T.data(), selected_attachment.c_str()))
|
||||||
|
{
|
||||||
|
weapon_item weapon = g_gta_data_service.weapon_by_hash(selected_weapon_hash);
|
||||||
|
if (!weapon.m_attachments.empty())
|
||||||
|
{
|
||||||
|
for (std::string attachment : weapon.m_attachments)
|
||||||
|
{
|
||||||
|
weapon_component attachment_component = g_gta_data_service.weapon_component_by_name(attachment);
|
||||||
|
std::string attachment_name = attachment_component.m_display_name;
|
||||||
|
Hash attachment_hash = attachment_component.m_hash;
|
||||||
|
|
||||||
|
if (attachment_name == "NULL" || attachment_hash == NULL)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
bool is_selected = attachment_hash == selected_attachment_hash;
|
||||||
|
ImGui::PushID(attachment_hash);
|
||||||
|
if (ImGui::Selectable(attachment_name.c_str(), is_selected, ImGuiSelectableFlags_None))
|
||||||
|
{
|
||||||
|
selected_attachment = attachment_name;
|
||||||
|
selected_attachment_hash = attachment_hash;
|
||||||
|
}
|
||||||
|
if (ImGui::IsItemHovered() && attachment_component.m_display_desc != "NULL")
|
||||||
|
{
|
||||||
|
ImGui::SetTooltip(attachment_component.m_display_desc.c_str());
|
||||||
|
}
|
||||||
|
if (is_selected)
|
||||||
|
{
|
||||||
|
ImGui::SetItemDefaultFocus();
|
||||||
|
}
|
||||||
|
ImGui::PopID();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ImGui::Text("NO_WEAPON_ATTACHMENT_IN_REGISTRY"_T.data());
|
||||||
|
}
|
||||||
|
ImGui::EndCombo();
|
||||||
|
}
|
||||||
|
components::button("VIEW_WEAPON_ADD_TO_WEAPON"_T, [] {
|
||||||
|
WEAPON::GIVE_WEAPON_COMPONENT_TO_PED(self::ped, selected_weapon_hash, selected_attachment_hash);
|
||||||
|
});
|
||||||
|
ImGui::SameLine();
|
||||||
|
components::button("VIEW_WEAPON_REMOVE_TO_WEAPON"_T, [] {
|
||||||
|
WEAPON::REMOVE_WEAPON_COMPONENT_FROM_PED(self::ped, selected_weapon_hash, selected_attachment_hash);
|
||||||
|
});
|
||||||
|
|
||||||
|
if ((!default_tints.empty() && !mk2_tints.empty()) && selected_weapon_hash != NULL)
|
||||||
|
{
|
||||||
|
if (is_weapon_mk2(selected_weapon_hash))
|
||||||
|
{
|
||||||
|
if (ImGui::BeginCombo("VIEW_WEAPON_TINTS"_T.data(), mk2_tints[selected_tint].data()))
|
||||||
|
{
|
||||||
|
for (int index = 0; index < mk2_tints.size(); index++)
|
||||||
|
{
|
||||||
|
if (ImGui::Selectable(mk2_tints[index].c_str()))
|
||||||
|
{
|
||||||
|
selected_tint = index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::EndCombo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (ImGui::BeginCombo("VIEW_WEAPON_TINTS"_T.data(), default_tints[selected_tint].data()))
|
||||||
|
{
|
||||||
|
for (int index = 0; index < default_tints.size(); index++)
|
||||||
|
{
|
||||||
|
if (ImGui::Selectable(default_tints[index].c_str()))
|
||||||
|
{
|
||||||
|
selected_tint = index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::EndCombo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
components::button("APPLY"_T, [] {
|
||||||
|
WEAPON::SET_PED_WEAPON_TINT_INDEX(self::ped, selected_weapon_hash, selected_tint);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::SeparatorText("VIEW_WEAPON_PERSIST_WEAPONS"_T.data());
|
||||||
|
|
||||||
|
static std::string selected_loadout = g.persist_weapons.weapon_loadout_file;
|
||||||
|
static std::string input_file_name;
|
||||||
|
|
||||||
|
ImGui::PushID(1);
|
||||||
|
ImGui::Checkbox("ENABLED"_T.data(), &g.persist_weapons.enabled);
|
||||||
|
ImGui::PopID();
|
||||||
|
|
||||||
|
ImGui::BeginGroup();
|
||||||
|
ImGui::Text("VIEW_WEAPON_PERSIST_WEAPONS_SAVED_LOADOUTS"_T.data());
|
||||||
|
if (ImGui::BeginListBox("##saved_loadouts", ImVec2(200, 200)))
|
||||||
|
{
|
||||||
|
for (std::string filename : persist_weapons::list_weapon_loadouts())
|
||||||
|
{
|
||||||
|
if (components::selectable(filename, filename == selected_loadout))
|
||||||
|
{
|
||||||
|
selected_loadout = filename;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::EndListBox();
|
||||||
|
}
|
||||||
|
ImGui::EndGroup();
|
||||||
|
ImGui::SameLine();
|
||||||
|
ImGui::BeginGroup();
|
||||||
|
ImGui::Text("VIEW_WEAPON_PERSIST_WEAPONS_WEAPON_LOADOUT_FILENAME"_T.data());
|
||||||
|
components::input_text_with_hint("##loadout_filename", "VIEW_WEAPON_PERSIST_WEAPONS_LOADOUT_NAME"_T, input_file_name);
|
||||||
|
components::button("VIEW_WEAPON_PERSIST_WEAPONS_SAVE"_T, [] {
|
||||||
|
persist_weapons::save_weapons(input_file_name);
|
||||||
|
input_file_name.clear();
|
||||||
|
});
|
||||||
|
ImGui::SameLine();
|
||||||
|
components::button("VIEW_WEAPON_PERSIST_WEAPONS_LOAD"_T, [] {
|
||||||
|
persist_weapons::give_player_loadout(selected_loadout);
|
||||||
|
});
|
||||||
|
ImGui::SameLine();
|
||||||
|
components::button("VIEW_WEAPON_PERSIST_WEAPONS_SET_LOADOUT"_T, [] {
|
||||||
|
persist_weapons::set_weapon_loadout(selected_loadout);
|
||||||
|
});
|
||||||
|
ImGui::Text(std::format("{}: {}:", "VIEW_WEAPON_PERSIST_WEAPONS_CURRENT_LOADOUT"_T, g.persist_weapons.weapon_loadout_file).data());
|
||||||
|
ImGui::EndGroup();
|
||||||
|
|
||||||
|
ImGui::SeparatorText("VIEW_WEAPON_WEAPON_HOTKEYS"_T.data());
|
||||||
|
|
||||||
|
static int selected_key = 0;
|
||||||
|
const char* const keys[]{"1", "2", "3", "4", "5", "6"};
|
||||||
|
|
||||||
|
ImGui::PushID(2);
|
||||||
|
ImGui::Checkbox("ENABLED"_T.data(), &g.weapons.enable_weapon_hotkeys);
|
||||||
|
ImGui::PopID();
|
||||||
|
if (ImGui::IsItemHovered())
|
||||||
|
{
|
||||||
|
ImGui::SetTooltip("VIEW_WEAPON_WEAPON_HOTKEYS_TOOLTIP"_T.data());
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::Combo("VIEW_WEAPON_WEAPON_HOTKEYS_KEY"_T.data(), &selected_key, keys, IM_ARRAYSIZE(keys));
|
||||||
|
if (!g.weapons.weapon_hotkeys[selected_key].empty())
|
||||||
|
{
|
||||||
|
int counter = 0;
|
||||||
|
for (auto& weapon_hash : g.weapons.weapon_hotkeys[selected_key])
|
||||||
|
{
|
||||||
|
weapon_item weapon = g_gta_data_service.weapon_by_hash(weapon_hash);
|
||||||
|
ImGui::PushID(counter);
|
||||||
|
if (ImGui::BeginCombo("GUI_TAB_WEAPONS"_T.data(), weapon.m_display_name.c_str()))
|
||||||
|
{
|
||||||
|
std::map<std::string, weapon_item> sorted_map;
|
||||||
|
for (const auto& [_, weapon_iter] : g_gta_data_service.weapons())
|
||||||
|
{
|
||||||
|
sorted_map.emplace(weapon_iter.m_display_name, weapon_iter);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto& [_, weapon_iter] : g_gta_data_service.weapons())
|
||||||
|
{
|
||||||
|
if (weapon_iter.m_display_name == "NULL")
|
||||||
|
continue;
|
||||||
|
|
||||||
|
bool is_selected = weapon_iter.m_hash == weapon_hash;
|
||||||
|
if (ImGui::Selectable(weapon_iter.m_display_name.c_str(), is_selected, ImGuiSelectableFlags_None))
|
||||||
|
{
|
||||||
|
weapon_hash = weapon_iter.m_hash;
|
||||||
|
}
|
||||||
|
if (is_selected)
|
||||||
|
{
|
||||||
|
ImGui::SetItemDefaultFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::EndCombo();
|
||||||
|
}
|
||||||
|
ImGui::SameLine();
|
||||||
|
components::button("VIEW_WEAPON_WEAPON_HOTKEYS_SET_TO_CURRENT_WEAPON"_T, [&weapon_hash] {
|
||||||
|
WEAPON::GET_CURRENT_PED_WEAPON(self::ped, &weapon_hash, NULL);
|
||||||
|
if (weapon_hash == NULL)
|
||||||
|
{
|
||||||
|
WEAPON::GET_CURRENT_PED_VEHICLE_WEAPON(self::ped, &weapon_hash);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
ImGui::SameLine();
|
||||||
|
if (ImGui::Button("VIEW_WEAPON_REMOVE_WEAPON"_T.data()))
|
||||||
|
{
|
||||||
|
g.weapons.weapon_hotkeys[selected_key].erase(g.weapons.weapon_hotkeys[selected_key].begin() + counter);
|
||||||
|
}
|
||||||
|
ImGui::PopID();
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ImGui::Button("VIEW_WEAPON_WEAPON_ADD_WEAPON"_T.data()))
|
||||||
|
{
|
||||||
|
g.weapons.weapon_hotkeys[selected_key].push_back(WEAPON_UNARMED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,12 +1,9 @@
|
|||||||
#include "core/data/bullet_impact_types.hpp"
|
#include "core/data/bullet_impact_types.hpp"
|
||||||
#include "core/data/special_ammo_types.hpp"
|
#include "core/data/special_ammo_types.hpp"
|
||||||
#include "gta/joaat.hpp"
|
#include "gta/joaat.hpp"
|
||||||
#include "gta/weapons.hpp"
|
|
||||||
#include "imgui_internal.h"
|
|
||||||
#include "natives.hpp"
|
|
||||||
#include "services/gta_data/gta_data_service.hpp"
|
#include "services/gta_data/gta_data_service.hpp"
|
||||||
#include "services/persist_weapons/persist_weapons.hpp"
|
|
||||||
#include "views/view.hpp"
|
#include "views/view.hpp"
|
||||||
|
#include "imgui_internal.h"
|
||||||
|
|
||||||
namespace big
|
namespace big
|
||||||
{
|
{
|
||||||
@ -107,24 +104,28 @@ namespace big
|
|||||||
{
|
{
|
||||||
WEAPON::GIVE_DELAYED_WEAPON_TO_PED(self::ped, weapon.m_hash, 9999, false);
|
WEAPON::GIVE_DELAYED_WEAPON_TO_PED(self::ped, weapon.m_hash, 9999, false);
|
||||||
}
|
}
|
||||||
|
WEAPON::GIVE_DELAYED_WEAPON_TO_PED(self::ped, "GADGET_PARACHUTE"_J, 0, true);
|
||||||
constexpr auto parachute_hash = "GADGET_PARACHUTE"_J;
|
|
||||||
WEAPON::GIVE_DELAYED_WEAPON_TO_PED(self::ped, parachute_hash, 0, true);
|
|
||||||
});
|
});
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
components::button("REMOVE_CUR_WEAPON"_T, [] {
|
components::button("REMOVE_ALL_WEAPONS"_T, [] {
|
||||||
Hash weaponHash;
|
for (const auto& [_, weapon] : g_gta_data_service.weapons())
|
||||||
WEAPON::GET_CURRENT_PED_WEAPON(self::ped, &weaponHash, 1);
|
|
||||||
if (weaponHash != "WEAPON_UNARMED"_J)
|
|
||||||
{
|
{
|
||||||
WEAPON::REMOVE_WEAPON_FROM_PED(self::ped, weaponHash);
|
if (weapon.m_hash != "WEAPON_UNARMED"_J)
|
||||||
|
WEAPON::REMOVE_WEAPON_FROM_PED(self::ped, weapon.m_hash);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
components::button("REMOVE_CUR_WEAPON"_T, [] {
|
||||||
|
Hash weapon_hash;
|
||||||
|
WEAPON::GET_CURRENT_PED_WEAPON(self::ped, &weapon_hash, 1);
|
||||||
|
if (weapon_hash != "WEAPON_UNARMED"_J)
|
||||||
|
WEAPON::REMOVE_WEAPON_FROM_PED(self::ped, weapon_hash);
|
||||||
|
});
|
||||||
|
ImGui::SameLine();
|
||||||
|
components::command_button<"resetweaps">();
|
||||||
|
|
||||||
components::command_checkbox<"incrdamage">();
|
components::command_checkbox<"incrdamage">();
|
||||||
ImGui::InputFloat("VIEW_WEAPON_DAMAGE"_T.data(), &g.weapons.increased_damage, .1, 10, "%.1f");
|
ImGui::InputFloat("VIEW_WEAPON_DAMAGE"_T.data(), &g.weapons.increased_damage, .1, 10, "%.1f");
|
||||||
|
|
||||||
|
|
||||||
components::command_checkbox<"flyingaxe">();
|
components::command_checkbox<"flyingaxe">();
|
||||||
|
|
||||||
components::command_checkbox<"modifyexplosionradius">();
|
components::command_checkbox<"modifyexplosionradius">();
|
||||||
@ -162,16 +163,7 @@ namespace big
|
|||||||
ImGui::Checkbox("VIEW_WEAPON_LAUNCH_ON_RELEASE"_T.data(), &g.weapons.gravity_gun.launch_on_release);
|
ImGui::Checkbox("VIEW_WEAPON_LAUNCH_ON_RELEASE"_T.data(), &g.weapons.gravity_gun.launch_on_release);
|
||||||
break;
|
break;
|
||||||
case CustomWeapon::VEHICLE_GUN:
|
case CustomWeapon::VEHICLE_GUN:
|
||||||
// this some ugly ass looking code
|
components::input_text_with_hint("SHOOTING_MODEL"_T, "NAME_VEHICLE_MODEL"_T, g.weapons.vehicle_gun_model);
|
||||||
static char vehicle_gun[12];
|
|
||||||
std::memcpy(vehicle_gun, g.weapons.vehicle_gun_model.c_str(), 12);
|
|
||||||
if (ImGui::InputTextWithHint("SHOOTING_MODEL"_T.data(), "NAME_VEHICLE_MODEL"_T.data(), vehicle_gun, sizeof(vehicle_gun)))
|
|
||||||
{
|
|
||||||
g.weapons.vehicle_gun_model = vehicle_gun;
|
|
||||||
}
|
|
||||||
if (ImGui::IsItemActive())
|
|
||||||
g.self.hud.typing = TYPING_TICKS;
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case CustomWeapon::PAINT_GUN:
|
case CustomWeapon::PAINT_GUN:
|
||||||
ImGui::Checkbox("RAINBOW_PAINT"_T.data(), &g.weapons.paintgun.rainbow);
|
ImGui::Checkbox("RAINBOW_PAINT"_T.data(), &g.weapons.paintgun.rainbow);
|
||||||
@ -197,33 +189,42 @@ namespace big
|
|||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
components::command_checkbox<"aimonlyatthreats">();
|
components::command_checkbox<"aimonlyatthreats">();
|
||||||
|
|
||||||
|
ImGui::BeginGroup();
|
||||||
ImGui::CheckboxFlags("PLAYERS"_T.data(), &g.weapons.aimbot.only_on_ped_type, (int64_t)ePedTypeFlag::PED_TYPE_NETWORK_PLAYER);
|
ImGui::CheckboxFlags("PLAYERS"_T.data(), &g.weapons.aimbot.only_on_ped_type, (int64_t)ePedTypeFlag::PED_TYPE_NETWORK_PLAYER);
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::CheckboxFlags("PED_TYPE_CIVMALE"_T.data(), &g.weapons.aimbot.only_on_ped_type, (int64_t)ePedTypeFlag::PED_TYPE_CIVMALE);
|
ImGui::CheckboxFlags("PED_TYPE_CIVMALE"_T.data(), &g.weapons.aimbot.only_on_ped_type, (int64_t)ePedTypeFlag::PED_TYPE_CIVMALE);
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::CheckboxFlags("PED_TYPE_CIVFEMALE"_T.data(), &g.weapons.aimbot.only_on_ped_type, (int64_t)ePedTypeFlag::PED_TYPE_CIVFEMALE);
|
ImGui::CheckboxFlags("PED_TYPE_CIVFEMALE"_T.data(), &g.weapons.aimbot.only_on_ped_type, (int64_t)ePedTypeFlag::PED_TYPE_CIVFEMALE);
|
||||||
|
ImGui::EndGroup();
|
||||||
|
|
||||||
|
ImGui::SameLine();
|
||||||
|
|
||||||
|
ImGui::BeginGroup();
|
||||||
ImGui::CheckboxFlags("PED_TYPE_DEALER"_T.data(), &g.weapons.aimbot.only_on_ped_type, (int64_t)ePedTypeFlag::PED_TYPE_DEALER);
|
ImGui::CheckboxFlags("PED_TYPE_DEALER"_T.data(), &g.weapons.aimbot.only_on_ped_type, (int64_t)ePedTypeFlag::PED_TYPE_DEALER);
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::CheckboxFlags("PED_TYPE_PROSTITUTE"_T.data(), &g.weapons.aimbot.only_on_ped_type, (int64_t)ePedTypeFlag::PED_TYPE_PROSTITUTE);
|
ImGui::CheckboxFlags("PED_TYPE_PROSTITUTE"_T.data(), &g.weapons.aimbot.only_on_ped_type, (int64_t)ePedTypeFlag::PED_TYPE_PROSTITUTE);
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::CheckboxFlags("PED_TYPE_BUM"_T.data(), &g.weapons.aimbot.only_on_ped_type, (int64_t)ePedTypeFlag::PED_TYPE_BUM);
|
ImGui::CheckboxFlags("PED_TYPE_BUM"_T.data(), &g.weapons.aimbot.only_on_ped_type, (int64_t)ePedTypeFlag::PED_TYPE_BUM);
|
||||||
|
ImGui::EndGroup();
|
||||||
|
|
||||||
|
ImGui::SameLine();
|
||||||
|
|
||||||
|
ImGui::BeginGroup();
|
||||||
ImGui::CheckboxFlags("PED_TYPE_MEDIC"_T.data(), &g.weapons.aimbot.only_on_ped_type, (int64_t)ePedTypeFlag::PED_TYPE_MEDIC);
|
ImGui::CheckboxFlags("PED_TYPE_MEDIC"_T.data(), &g.weapons.aimbot.only_on_ped_type, (int64_t)ePedTypeFlag::PED_TYPE_MEDIC);
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::CheckboxFlags("PED_TYPE_FIREMAN"_T.data(), &g.weapons.aimbot.only_on_ped_type, (int64_t)ePedTypeFlag::PED_TYPE_FIREMAN);
|
ImGui::CheckboxFlags("PED_TYPE_FIREMAN"_T.data(), &g.weapons.aimbot.only_on_ped_type, (int64_t)ePedTypeFlag::PED_TYPE_FIREMAN);
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::CheckboxFlags("PED_TYPE_ARMY"_T.data(), &g.weapons.aimbot.only_on_ped_type, (int64_t)ePedTypeFlag::PED_TYPE_ARMY);
|
ImGui::CheckboxFlags("PED_TYPE_ARMY"_T.data(), &g.weapons.aimbot.only_on_ped_type, (int64_t)ePedTypeFlag::PED_TYPE_ARMY);
|
||||||
|
ImGui::EndGroup();
|
||||||
|
|
||||||
ImGui::CheckboxFlags("POLICE"_T.data(), &g.weapons.aimbot.only_on_ped_type, (int64_t)ePedTypeFlag::PED_TYPE_COP);
|
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::CheckboxFlags("PED_TYPE_SWAT"_T.data(), &g.weapons.aimbot.only_on_ped_type, (int64_t)ePedTypeFlag::PED_TYPE_SWAT);
|
|
||||||
|
|
||||||
|
ImGui::BeginGroup();
|
||||||
ImGui::CheckboxFlags("GUI_TAB_MISSIONS"_T.data(), &g.weapons.aimbot.only_on_ped_type, (int64_t)ePedTypeFlag::PED_TYPE_MISSION);
|
ImGui::CheckboxFlags("GUI_TAB_MISSIONS"_T.data(), &g.weapons.aimbot.only_on_ped_type, (int64_t)ePedTypeFlag::PED_TYPE_MISSION);
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::CheckboxFlags("PED_TYPE_ANIMAL"_T.data(), &g.weapons.aimbot.only_on_ped_type, (int64_t)ePedTypeFlag::PED_TYPE_ANIMAL);
|
ImGui::CheckboxFlags("PED_TYPE_ANIMAL"_T.data(), &g.weapons.aimbot.only_on_ped_type, (int64_t)ePedTypeFlag::PED_TYPE_ANIMAL);
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::CheckboxFlags("PED_TYPE_SPECIAL"_T.data(), &g.weapons.aimbot.only_on_ped_type, (int64_t)ePedTypeFlag::PED_TYPE_SPECIAL);
|
ImGui::CheckboxFlags("PED_TYPE_SPECIAL"_T.data(), &g.weapons.aimbot.only_on_ped_type, (int64_t)ePedTypeFlag::PED_TYPE_SPECIAL);
|
||||||
|
ImGui::EndGroup();
|
||||||
|
|
||||||
|
ImGui::SameLine();
|
||||||
|
|
||||||
|
ImGui::BeginGroup();
|
||||||
|
ImGui::CheckboxFlags("POLICE"_T.data(), &g.weapons.aimbot.only_on_ped_type, (int64_t)ePedTypeFlag::PED_TYPE_COP);
|
||||||
|
ImGui::CheckboxFlags("PED_TYPE_SWAT"_T.data(), &g.weapons.aimbot.only_on_ped_type, (int64_t)ePedTypeFlag::PED_TYPE_SWAT);
|
||||||
|
ImGui::EndGroup();
|
||||||
|
|
||||||
ImGui::PushItemWidth(350);
|
ImGui::PushItemWidth(350);
|
||||||
ImGui::SliderFloat("VIEW_WEAPON_AIM_FOV"_T.data(), &g.weapons.aimbot.fov, 1.f, 360.f, "%.0f");
|
ImGui::SliderFloat("VIEW_WEAPON_AIM_FOV"_T.data(), &g.weapons.aimbot.fov, 1.f, 360.f, "%.0f");
|
||||||
@ -236,222 +237,5 @@ namespace big
|
|||||||
ImGui::Checkbox("BACKEND_LOOPED_WEAPONS_USE_MAX_RANGE"_T.data(), &g.weapons.aimbot.use_weapon_range);
|
ImGui::Checkbox("BACKEND_LOOPED_WEAPONS_USE_MAX_RANGE"_T.data(), &g.weapons.aimbot.use_weapon_range);
|
||||||
ImGui::PopItemWidth();
|
ImGui::PopItemWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::PushID("ammunation_view");
|
|
||||||
if (ImGui::CollapsingHeader("VIEW_WEAPON_AMMUNATION"_T.data()))
|
|
||||||
{
|
|
||||||
static Hash selected_weapon_hash, selected_weapon_attachment_hash{};
|
|
||||||
static std::string selected_weapon, selected_weapon_attachment;
|
|
||||||
ImGui::PushItemWidth(300);
|
|
||||||
if (ImGui::BeginCombo("GUI_TAB_WEAPONS"_T.data(), selected_weapon.c_str()))
|
|
||||||
{
|
|
||||||
std::map<std::string, weapon_item> sorted_map;
|
|
||||||
for (const auto& [_, weapon] : g_gta_data_service.weapons())
|
|
||||||
{
|
|
||||||
sorted_map.emplace(weapon.m_display_name, weapon);
|
|
||||||
}
|
|
||||||
for (const auto& weapon : sorted_map)
|
|
||||||
{
|
|
||||||
bool is_selected = weapon.second.m_hash == selected_weapon_hash;
|
|
||||||
if (weapon.second.m_display_name != "NULL" && ImGui::Selectable(weapon.second.m_display_name.c_str(), is_selected, ImGuiSelectableFlags_None))
|
|
||||||
{
|
|
||||||
selected_weapon = weapon.second.m_display_name;
|
|
||||||
selected_weapon_hash = weapon.second.m_hash;
|
|
||||||
selected_weapon_attachment_hash = {};
|
|
||||||
selected_weapon_attachment.clear();
|
|
||||||
}
|
|
||||||
if (is_selected)
|
|
||||||
{
|
|
||||||
ImGui::SetItemDefaultFocus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ImGui::EndCombo();
|
|
||||||
}
|
|
||||||
ImGui::PopItemWidth();
|
|
||||||
ImGui::SameLine();
|
|
||||||
components::button("VIEW_WEAPON_GIVE_WEAPON"_T, [] {
|
|
||||||
WEAPON::GIVE_WEAPON_TO_PED(self::ped, selected_weapon_hash, 9999, false, true);
|
|
||||||
});
|
|
||||||
ImGui::SameLine();
|
|
||||||
components::button("VIEW_WEAPON_REMOVE_WEAPON"_T, [] {
|
|
||||||
WEAPON::REMOVE_WEAPON_FROM_PED(self::ped, selected_weapon_hash);
|
|
||||||
});
|
|
||||||
|
|
||||||
ImGui::PushItemWidth(250);
|
|
||||||
if (ImGui::BeginCombo("VIEW_WEAPON_ATTACHMENTS"_T.data(), selected_weapon_attachment.c_str()))
|
|
||||||
{
|
|
||||||
weapon_item weapon = g_gta_data_service.weapon_by_hash(selected_weapon_hash);
|
|
||||||
if (!weapon.m_attachments.empty())
|
|
||||||
{
|
|
||||||
for (std::string attachment : weapon.m_attachments)
|
|
||||||
{
|
|
||||||
weapon_component attachment_component = g_gta_data_service.weapon_component_by_name(attachment);
|
|
||||||
std::string attachment_name = attachment_component.m_display_name;
|
|
||||||
Hash attachment_hash = attachment_component.m_hash;
|
|
||||||
if (attachment_hash == NULL)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
ImGui::PushID(attachment_hash);
|
|
||||||
bool is_selected = attachment_hash == selected_weapon_attachment_hash;
|
|
||||||
if (ImGui::Selectable(attachment_name.c_str(), is_selected, ImGuiSelectableFlags_None))
|
|
||||||
{
|
|
||||||
selected_weapon_attachment = attachment_name;
|
|
||||||
selected_weapon_attachment_hash = attachment_hash;
|
|
||||||
}
|
|
||||||
if (ImGui::IsItemHovered() && !attachment_component.m_display_desc.empty())
|
|
||||||
ImGui::SetTooltip(attachment_component.m_display_desc.c_str());
|
|
||||||
if (is_selected)
|
|
||||||
{
|
|
||||||
ImGui::SetItemDefaultFocus();
|
|
||||||
}
|
|
||||||
ImGui::PopID();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::EndCombo();
|
|
||||||
}
|
|
||||||
ImGui::SameLine();
|
|
||||||
components::button("VIEW_WEAPON_ADD_TO_WEAPON"_T, [] {
|
|
||||||
WEAPON::GIVE_WEAPON_COMPONENT_TO_PED(self::ped, selected_weapon_hash, selected_weapon_attachment_hash);
|
|
||||||
});
|
|
||||||
ImGui::SameLine();
|
|
||||||
components::button("VIEW_WEAPON_REMOVE_TO_WEAPON"_T, [] {
|
|
||||||
WEAPON::REMOVE_WEAPON_COMPONENT_FROM_PED(self::ped, selected_weapon_hash, selected_weapon_attachment_hash);
|
|
||||||
});
|
|
||||||
ImGui::PopItemWidth();
|
|
||||||
|
|
||||||
static const char* default_tints[]{"Black tint", "Green tint", "Gold tint", "Pink tint", "Army tint", "LSPD tint", "Orange tint", "Platinum tint"};
|
|
||||||
static const char* mk2_tints[]{"Classic Black", "Classic Grey", "Classic Two - Tone", "Classic White", "Classic Beige", "Classic Green", "Classic Blue", "Classic Earth", "Classic Brown & Black", "Red Contrast", "Blue Contrast", "Yellow Contrast", "Orange Contrast", "Bold Pink", "Bold Purple & Yellow", "Bold Orange", "Bold Green & Purple", "Bold Red Features", "Bold Green Features", "Bold Cyan Features", "Bold Yellow Features", "Bold Red & White", "Bold Blue & White", "Metallic Gold", "Metallic Platinum", "Metallic Grey & Lilac", "Metallic Purple & Lime", "Metallic Red", "Metallic Green", "Metallic Blue", "Metallic White & Aqua", "Metallic Red & Yellow"};
|
|
||||||
static int tint;
|
|
||||||
|
|
||||||
if (selected_weapon.ends_with("Mk II"))
|
|
||||||
{
|
|
||||||
ImGui::Combo("VIEW_WEAPON_TINTS"_T.data(), &tint, mk2_tints, IM_ARRAYSIZE(mk2_tints));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ImGui::Combo("VIEW_WEAPON_TINTS"_T.data(), &tint, default_tints, IM_ARRAYSIZE(default_tints));
|
|
||||||
}
|
|
||||||
ImGui::SameLine();
|
|
||||||
components::button("APPLY"_T, [] {
|
|
||||||
WEAPON::SET_PED_WEAPON_TINT_INDEX(self::ped, selected_weapon_hash, tint);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
ImGui::PopID();
|
|
||||||
if (ImGui::CollapsingHeader("VIEW_WEAPON_PERSIST_WEAPONS"_T.data()))
|
|
||||||
{
|
|
||||||
ImGui::PushID(1);
|
|
||||||
ImGui::Checkbox("ENABLED"_T.data(), &g.persist_weapons.enabled);
|
|
||||||
ImGui::PopID();
|
|
||||||
|
|
||||||
static std::string selected_loadout = g.persist_weapons.weapon_loadout_file;
|
|
||||||
ImGui::PushItemWidth(250);
|
|
||||||
if (ImGui::BeginListBox("VIEW_WEAPON_PERSIST_WEAPONS_SAVED_LOADOUTS"_T.data(), ImVec2(200, 200)))
|
|
||||||
{
|
|
||||||
for (std::string filename : persist_weapons::list_weapon_loadouts())
|
|
||||||
{
|
|
||||||
if (components::selectable(filename, filename == selected_loadout))
|
|
||||||
{
|
|
||||||
selected_loadout = filename;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ImGui::EndListBox();
|
|
||||||
}
|
|
||||||
ImGui::SameLine();
|
|
||||||
ImGui::BeginGroup();
|
|
||||||
static std::string input_file_name;
|
|
||||||
components::input_text_with_hint("VIEW_WEAPON_PERSIST_WEAPONS_WEAPON_LOADOUT_FILENAME"_T, "VIEW_WEAPON_PERSIST_WEAPONS_LOADOUT_NAME"_T, input_file_name);
|
|
||||||
components::button("VIEW_WEAPON_PERSIST_WEAPONS_SAVE"_T, [] {
|
|
||||||
persist_weapons::save_weapons(input_file_name);
|
|
||||||
input_file_name.clear();
|
|
||||||
});
|
|
||||||
ImGui::SameLine();
|
|
||||||
components::button("VIEW_WEAPON_PERSIST_WEAPONS_LOAD"_T, [] {
|
|
||||||
persist_weapons::give_player_loadout(selected_loadout);
|
|
||||||
});
|
|
||||||
ImGui::SameLine();
|
|
||||||
components::button("VIEW_WEAPON_PERSIST_WEAPONS_SET_LOADOUT"_T, [] {
|
|
||||||
persist_weapons::set_weapon_loadout(selected_loadout);
|
|
||||||
});
|
|
||||||
ImGui::Text(std::format("{}: {}:", "VIEW_WEAPON_PERSIST_WEAPONS_CURRENT_LOADOUT"_T, g.persist_weapons.weapon_loadout_file)
|
|
||||||
.data());
|
|
||||||
ImGui::EndGroup();
|
|
||||||
ImGui::PopItemWidth();
|
|
||||||
}
|
|
||||||
if (ImGui::CollapsingHeader("VIEW_WEAPON_WEAPON_HOTKEYS"_T.data()))
|
|
||||||
{
|
|
||||||
ImGui::PushID(2);
|
|
||||||
ImGui::Checkbox("ENABLED"_T.data(), &g.weapons.enable_weapon_hotkeys);
|
|
||||||
ImGui::PopID();
|
|
||||||
if (ImGui::IsItemHovered())
|
|
||||||
{
|
|
||||||
ImGui::SetTooltip("VIEW_WEAPON_WEAPON_HOTKEYS_TOOLTIP"_T.data());
|
|
||||||
}
|
|
||||||
|
|
||||||
static int selected_key = 0;
|
|
||||||
const char* const keys[]{"1", "2", "3", "4", "5", "6"};
|
|
||||||
|
|
||||||
ImGui::PushItemWidth(250);
|
|
||||||
ImGui::Combo("VIEW_WEAPON_WEAPON_HOTKEYS_KEY"_T.data(), &selected_key, keys, IM_ARRAYSIZE(keys));
|
|
||||||
ImGui::PopItemWidth();
|
|
||||||
|
|
||||||
if (!g.weapons.weapon_hotkeys[selected_key].empty())
|
|
||||||
{
|
|
||||||
int counter{};
|
|
||||||
for (auto& weapon_hash : g.weapons.weapon_hotkeys[selected_key])
|
|
||||||
{
|
|
||||||
ImGui::PushID(counter);
|
|
||||||
weapon_item weapon = g_gta_data_service.weapon_by_hash(weapon_hash);
|
|
||||||
ImGui::PushItemWidth(300);
|
|
||||||
if (ImGui::BeginCombo("GUI_TAB_WEAPONS"_T.data(), weapon.m_display_name.c_str()))
|
|
||||||
{
|
|
||||||
std::map<std::string, weapon_item> sorted_map;
|
|
||||||
for (const auto& [_, weapon_iter] : g_gta_data_service.weapons())
|
|
||||||
{
|
|
||||||
sorted_map.emplace(weapon_iter.m_display_name, weapon_iter);
|
|
||||||
}
|
|
||||||
for (const auto& [_, weapon_iter] : g_gta_data_service.weapons())
|
|
||||||
{
|
|
||||||
if (weapon_iter.m_display_name == "NULL")
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
bool is_selected = weapon_iter.m_hash == weapon_hash;
|
|
||||||
if (ImGui::Selectable(weapon_iter.m_display_name.c_str(), is_selected, ImGuiSelectableFlags_None))
|
|
||||||
{
|
|
||||||
weapon_hash = weapon_iter.m_hash;
|
|
||||||
}
|
|
||||||
if (is_selected)
|
|
||||||
{
|
|
||||||
ImGui::SetItemDefaultFocus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ImGui::EndCombo();
|
|
||||||
}
|
|
||||||
ImGui::SameLine();
|
|
||||||
components::button("VIEW_WEAPON_WEAPON_HOTKEYS_SET_TO_CURRENT_WEAPON"_T, [&weapon_hash] {
|
|
||||||
WEAPON::GET_CURRENT_PED_WEAPON(self::ped, &weapon_hash, NULL);
|
|
||||||
if (weapon_hash == NULL)
|
|
||||||
{
|
|
||||||
WEAPON::GET_CURRENT_PED_VEHICLE_WEAPON(self::ped, &weapon_hash);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
ImGui::SameLine();
|
|
||||||
if (ImGui::Button("VIEW_WEAPON_REMOVE_WEAPON"_T.data()))
|
|
||||||
{
|
|
||||||
g.weapons.weapon_hotkeys[selected_key].erase(g.weapons.weapon_hotkeys[selected_key].begin() + counter);
|
|
||||||
}
|
|
||||||
ImGui::PopID();
|
|
||||||
ImGui::PopItemWidth();
|
|
||||||
counter++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ImGui::Button("VIEW_WEAPON_WEAPON_ADD_WEAPON"_T.data()))
|
|
||||||
{
|
|
||||||
g.weapons.weapon_hotkeys[selected_key].push_back(WEAPON_UNARMED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,6 +67,7 @@ namespace big
|
|||||||
static void view_player();
|
static void view_player();
|
||||||
static void players();
|
static void players();
|
||||||
static void weapons();
|
static void weapons();
|
||||||
|
static void ammunation();
|
||||||
static void context_menu();
|
static void context_menu();
|
||||||
static void gta_data();
|
static void gta_data();
|
||||||
static void creator();
|
static void creator();
|
||||||
|
Loading…
Reference in New Issue
Block a user