(feat) option Fix to context menu (#1962)

This commit is contained in:
alyxme 2023-08-25 01:07:35 +05:00 committed by GitHub
parent afa79d8600
commit 5c4f16a474

View File

@ -62,7 +62,8 @@ namespace big
s_context_menu vehicle_menu{ContextEntityType::VEHICLE, s_context_menu vehicle_menu{ContextEntityType::VEHICLE,
0, 0,
{}, {},
{{"KILL ENGINE", {
{"KILL ENGINE",
[this] { [this] {
if (entity::take_control_of(m_handle)) if (entity::take_control_of(m_handle))
{ {
@ -72,6 +73,18 @@ namespace big
else else
g_notification_service->push_warning("Toxic", "Failed to take control of vehicle."); g_notification_service->push_warning("Toxic", "Failed to take control of vehicle.");
}}, }},
{"FIX VEHICLE",
[this] {
if (entity::take_control_of(m_handle))
{
VEHICLE::SET_VEHICLE_ENGINE_HEALTH(m_handle, 1000.f);
VEHICLE::SET_VEHICLE_FIXED(m_handle);
VEHICLE::SET_VEHICLE_DEFORMATION_FIXED(m_handle);
VEHICLE::SET_VEHICLE_DIRT_LEVEL(m_handle, 0.f);
}
else
g_notification_service->push_warning("Warning", "Failed to take control of vehicle.");
}},
{"BURST TIRES", {"BURST TIRES",
[this] { [this] {
if (entity::take_control_of(m_handle)) if (entity::take_control_of(m_handle))
@ -128,12 +141,14 @@ namespace big
}}, }},
{"TP INTO", [this] { {"TP INTO", [this] {
teleport::into_vehicle(m_handle); teleport::into_vehicle(m_handle);
}}}}; }}
}};
s_context_menu ped_menu{ContextEntityType::PED, s_context_menu ped_menu{ContextEntityType::PED,
0, 0,
{}, {},
{{"DISARM", {
{"DISARM",
[this] { [this] {
for (auto& [_, weapon] : g_gta_data_service->weapons()) for (auto& [_, weapon] : g_gta_data_service->weapons())
WEAPON::REMOVE_WEAPON_FROM_PED(m_handle, weapon.m_hash); WEAPON::REMOVE_WEAPON_FROM_PED(m_handle, weapon.m_hash);
@ -170,20 +185,22 @@ namespace big
WEAPON::GIVE_WEAPON_TO_PED(m_handle, RAGE_JOAAT("weapon_microsmg"), 9999, false, false); WEAPON::GIVE_WEAPON_TO_PED(m_handle, RAGE_JOAAT("weapon_microsmg"), 9999, false, false);
WEAPON::GIVE_WEAPON_TO_PED(m_handle, RAGE_JOAAT("weapon_carbinerifle"), 9999, false, true); WEAPON::GIVE_WEAPON_TO_PED(m_handle, RAGE_JOAAT("weapon_carbinerifle"), 9999, false, true);
TASK::TASK_COMBAT_HATED_TARGETS_AROUND_PED(self::ped, 100, 67108864); TASK::TASK_COMBAT_HATED_TARGETS_AROUND_PED(self::ped, 100, 67108864);
}}}}; }}
}};
s_context_menu object_menu{ContextEntityType::OBJECT, 0, {}, {}}; s_context_menu object_menu{ContextEntityType::OBJECT, 0, {}, {}};
s_context_menu player_menu{ContextEntityType::PLAYER, s_context_menu player_menu{ContextEntityType::PLAYER,
0, 0,
{}, {},
{{"SET SELECTED", {
{"SET SELECTED",
[this] { [this] {
g_player_service->set_selected(ped::get_player_from_ped(m_handle)); g_player_service->set_selected(ped::get_player_from_ped(m_handle));
}}, }},
{"STEAL IDENTITY", {"STEAL OUTFIT",
[this] { [this] {
ped::steal_identity(m_handle); ped::steal_outfit(m_handle);
}}, }},
{"KICK", {"KICK",
[this] { [this] {
@ -199,12 +216,19 @@ namespace big
{"RAGDOLL", [this] { {"RAGDOLL", [this] {
static player_command* command = dynamic_cast<player_command*>(command::get(rage::consteval_joaat("ragdoll"))); static player_command* command = dynamic_cast<player_command*>(command::get(rage::consteval_joaat("ragdoll")));
command->call(ped::get_player_from_ped(m_handle), {}); command->call(ped::get_player_from_ped(m_handle), {});
}}}}; }}
}};
s_context_menu shared_menu{ContextEntityType::SHARED, s_context_menu shared_menu{ContextEntityType::SHARED,
0, 0,
{}, {},
{{"EXPLODE", {
{"COPY HASH", [this] {
ImGui::SetClipboardText(std::format("0x{:08X}", (rage::joaat_t)m_pointer->m_model_info->m_hash).c_str());
g_notification_service->push("Context Menu",
std::format("Copy hash 0x{:08X}", (rage::joaat_t)m_pointer->m_model_info->m_hash).c_str());
}},
{"EXPLODE",
[this] { [this] {
rage::fvector3 pos = *m_pointer->m_navigation->get_position(); rage::fvector3 pos = *m_pointer->m_navigation->get_position();
FIRE::ADD_EXPLOSION(pos.x, pos.y, pos.z, 1, 1000, 1, 0, 1, 0); FIRE::ADD_EXPLOSION(pos.x, pos.y, pos.z, 1, 1000, 1, 0, 1, 0);
@ -250,12 +274,8 @@ namespace big
{ {
entity::delete_entity(m_handle); entity::delete_entity(m_handle);
} }
}}, }}
{"COPY HASH", [this] { }};
ImGui::SetClipboardText(std::format("0x{:08X}", (rage::joaat_t)m_pointer->m_model_info->m_hash).c_str());
g_notification_service->push("Context Menu",
std::format("Copy hash 0x{:08X}", (rage::joaat_t)m_pointer->m_model_info->m_hash).c_str());
}}}};
std::unordered_map<ContextEntityType, s_context_menu> options = {{ContextEntityType::VEHICLE, vehicle_menu}, {ContextEntityType::PLAYER, player_menu}, {ContextEntityType::PED, ped_menu}, {ContextEntityType::SHARED, shared_menu}, {ContextEntityType::OBJECT, object_menu}}; std::unordered_map<ContextEntityType, s_context_menu> options = {{ContextEntityType::VEHICLE, vehicle_menu}, {ContextEntityType::PLAYER, player_menu}, {ContextEntityType::PED, ped_menu}, {ContextEntityType::SHARED, shared_menu}, {ContextEntityType::OBJECT, object_menu}};
}; };