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/src/views/self/view_teleport.cpp

146 lines
4.4 KiB
C++
Raw Normal View History

2023-04-29 13:29:28 +02:00
#include "core/data/ipls.hpp"
2022-02-28 23:04:56 +01:00
#include "fiber_pool.hpp"
#include "util/globals.hpp"
2022-07-27 14:39:22 +02:00
#include "util/mobile.hpp"
2022-02-28 23:04:56 +01:00
#include "util/teleport.hpp"
#include "util/vehicle.hpp"
#include "views/view.hpp"
2022-02-28 23:04:56 +01:00
namespace big
{
2022-06-27 15:45:26 +02:00
void view::teleport()
{
2023-06-27 14:05:44 +02:00
ImGui::SeparatorText("BLIPS"_T.data());
ImGui::Spacing();
2022-02-28 23:04:56 +01:00
components::command_button<"waypointtp">({}, "Waypoint");
ImGui::SameLine();
components::command_button<"objectivetp">({}, "Objective");
components::command_checkbox<"autotptowp">();
2022-12-06 16:12:02 +00:00
2023-06-27 14:05:44 +02:00
ImGui::SeparatorText("Movement");
ImGui::Spacing();
components::small_text("Current coordinates");
float coords[3] = {self::pos.x, self::pos.y, self::pos.z};
static float new_location[3];
static float increment = 1;
ImGui::SetNextItemWidth(400);
ImGui::InputFloat3("##currentcoordinates", coords, "%f", ImGuiInputTextFlags_ReadOnly);
ImGui::SameLine();
components::button("Copy to custom", [coords] {
std::copy(std::begin(coords), std::end(coords), std::begin(new_location));
});
components::small_text("Custom teleport");
ImGui::SetNextItemWidth(400);
ImGui::InputFloat3("##Customlocation", new_location);
ImGui::SameLine();
components::button("Teleport", [] {
teleport::teleport_player_to_coords(g_player_service->get_self(), {new_location[0], new_location[1], new_location[2]});
});
ImGui::Spacing();
components::small_text("Specific movement");
ImGui::Spacing();
ImGui::SetNextItemWidth(200);
ImGui::InputFloat("Distance", &increment);
ImGui::BeginGroup();
components::button("Forward", [] {
teleport::teleport_player_to_coords(g_player_service->get_self(), ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(self::ped, 0, increment, 0));
});
components::button("Backward", [] {
teleport::teleport_player_to_coords(g_player_service->get_self(), ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(self::ped, 0, -increment, 0));
});
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
components::button("Left", [] {
teleport::teleport_player_to_coords(g_player_service->get_self(), ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(self::ped, -increment, 0, 0));
});
components::button("Right", [] {
teleport::teleport_player_to_coords(g_player_service->get_self(), ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(self::ped, increment, 0, 0));
});
ImGui::EndGroup();
ImGui::SameLine();
ImGui::BeginGroup();
components::button("Up", [] {
teleport::teleport_player_to_coords(g_player_service->get_self(), ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(self::ped, 0, 0, increment));
});
components::button("Down", [] {
teleport::teleport_player_to_coords(g_player_service->get_self(), ENTITY::GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS(self::ped, 0, 0, -increment));
});
ImGui::EndGroup();
2023-06-27 14:05:44 +02:00
ImGui::SeparatorText("VEHICLES"_T.data());
ImGui::Spacing();
components::command_button<"lastvehtp">();
ImGui::SameLine();
components::command_button<"bringpv">();
ImGui::SameLine();
components::command_button<"pvtp">();
2023-04-29 13:29:28 +02:00
2023-06-27 14:05:44 +02:00
ImGui::SeparatorText("GUI_TAB_IPL"_T.data());
2023-04-29 13:29:28 +02:00
if (ImGui::BeginCombo("IPL_LOCATION"_T.data(), ipls[g.self.ipls.select].friendly_name))
{
for (int i = 0; i < IM_ARRAYSIZE(ipls); i++)
{
if (ImGui::Selectable(ipls[i].friendly_name, i == g.self.ipls.select))
g.self.ipls.select = i;
if (i == g.self.ipls.select)
ImGui::SetItemDefaultFocus();
}
ImGui::EndCombo();
}
const auto& selected_ipl = ipls[g.self.ipls.select];
2023-04-29 13:29:28 +02:00
if (components::button("LOAD_IPL"_T.data()))
{
//unload all previous ipls
for (auto& ipl : ipls)
for (auto& ipl_name : ipl.ipl_names)
{
if (STREAMING::IS_IPL_ACTIVE(ipl_name))
{
LOG(INFO) << "unloading existing ipl " << ipl_name;
STREAMING::REMOVE_IPL(ipl_name);
}
}
//load the new ipl
for (auto& ipl_name : selected_ipl.ipl_names)
STREAMING::REQUEST_IPL(ipl_name);
}
ImGui::SameLine();
if (components::button("TP_TO_IPL"_T.data()))
{
PED::SET_PED_COORDS_KEEP_VEHICLE(self::ped,
selected_ipl.location.x,
selected_ipl.location.y,
selected_ipl.location.z);
}
ImGui::Spacing();
components::small_text("IPL_INFOS"_T.data());
2023-04-29 13:29:28 +02:00
ImGui::Text(std::vformat("IPL_CNT"_T, std::make_format_args(selected_ipl.ipl_names.size())).data());
ImGui::Text(std::vformat("IPL_POSITION"_T,
std::make_format_args(selected_ipl.location.x, selected_ipl.location.y, selected_ipl.location.z))
.data());
2022-02-28 23:04:56 +01:00
}
2022-06-27 15:45:26 +02:00
}