This repository has been archived on 2024-10-22. You can view files and clone it, but cannot push or open issues or pull requests.
YimMenu/BigBaseV2/src/gui/handling/handling_my_profiles.cpp
karifeld 04142b2d98
refactor: Modernized/optimized general code, bug fixing and more (#226)
* refactor: Use self globals

* refactor: Use gui::components

* fix(Vehicle Preview): Addresses #119

Previewed vehicle set to unclimbable

Only preview when hovered on vehicle

* fix(Infinite Clip): Disabling it now works

* fix(No Ragdoll): Disabling it now works

Removed unnecessary calls to natives (0xB128377056A54E2A should be enough)

* fix(Spawn): Wrong footer placement

* fix self globals file name typo

* refactor(Mobile): Clear ped tasks when set conditions are met

Only clear ped tasks if pv_teleport_into bool is true and ped is in a vehicle

* feat(Weapons): Remove current weapon

* refactor: Added missing variable in calls to self globals

* refactor: Utilize usage of ControllerInputs

* fix(Vehicle Fly): uninitialized local variable 'ped' used

* refactor(No Ragdoll, Infinite Clip): Only run on boolean change.

* refactor(Infinite Ammo): Simplified code

* refactor: Utilize ControllerInputs in other areas of code

* refactor: Utilize ControllerInputs in other areas of code
2022-05-22 18:38:45 -04:00

59 lines
1.6 KiB
C++

#include "services/vehicle_service.hpp"
#include "views/view.hpp"
namespace big
{
void view::handling_my_profiles()
{
if (g_local_player == nullptr || g_local_player->m_vehicle == nullptr || g_local_player->m_ped_task_flag & (int)ePedTask::TASK_FOOT)
{
ImGui::Text("Please enter a vehicle.");
return;
}
if (!g_vehicle_service->update_mine())
ImGui::Text("Loading profiles...");
else
{
if (g_vehicle_service->m_my_profiles.size() == 0)
ImGui::Text("You have no profiles available for this vehicle.");
for (auto& key : g_vehicle_service->m_my_profiles)
{
if (auto it = g_vehicle_service->m_handling_profiles.find(key); it != g_vehicle_service->m_handling_profiles.end())
{
auto& profile = it->second;
if (profile.share_code == g_vehicle_service->get_active_profile(profile.handling_hash))
ImGui::TextColored({ 0.1254f,0.8039f,0.3137f,1.f }, "Active");
ImGui::BeginTable("table", 3, ImGuiTableFlags_SizingStretchProp);
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::Text("Name:");
ImGui::TableNextColumn();
ImGui::Text(profile.name.c_str());
ImGui::TableNextColumn();
ImGui::Text("Share Code: %s", profile.share_code.c_str());
ImGui::TableNextRow();
ImGui::TableNextColumn();
ImGui::Text("Description:");
ImGui::TableNextColumn();
ImGui::TextWrapped(profile.description.c_str());
ImGui::TableNextColumn();
if (components::button("Load Profile"))
g_vehicle_service->set_handling_profile(profile);
ImGui::EndTable();
ImGui::Separator();
}
}
}
}
}