feat(Teleport): Moved teleport personal vehicel to teleport tab

This commit is contained in:
Yimura 2022-01-08 23:59:32 +01:00
parent 9828ee50a1
commit 780eece778
No known key found for this signature in database
GPG Key ID: 3D8FF4397E768682
3 changed files with 44 additions and 17 deletions

View File

@ -1,6 +1,8 @@
#include "main_tabs.hpp"
#include "fiber_pool.hpp"
#include "script_global.hpp"
#include "util/teleport.hpp"
#include "util/vehicle.hpp"
namespace big
{
@ -8,6 +10,10 @@ namespace big
{
if (ImGui::BeginTabItem("Teleport"))
{
ImGui::BeginChild("col1", { 200.f, 0.f });
ImGui::Text("Blips:");
if (ImGui::Button("Waypoint"))
{
QUEUE_JOB_BEGIN_CLAUSE()
@ -30,6 +36,38 @@ namespace big
}QUEUE_JOB_END_CLAUSE
}
ImGui::EndChild();
ImGui::SameLine();
ImGui::BeginChild("col2", { 0.f, 0.f });
ImGui::Text("Vehicles:");
if (ImGui::Button("Bring Personal Vehicle"))
{
QUEUE_JOB_BEGIN_CLAUSE()
{
Vehicle veh = *script_global(2810287).at(298).as<Vehicle*>();
if (ENTITY::IS_ENTITY_DEAD(veh, false)) return notify::above_map("Invalid vehicle handle...");
Vector3 location = ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), true);
vehicle::bring(veh, location);
}QUEUE_JOB_END_CLAUSE
}
if (ImGui::Button("Teleport to Personal Vehicle"))
{
Vehicle veh = *script_global(2810287).at(298).as<Vehicle*>();
if (ENTITY::IS_ENTITY_DEAD(veh, false)) return notify::above_map("Invalid vehicle handle...");
teleport::to_coords(
ENTITY::GET_ENTITY_COORDS(veh, true)
);
}
ImGui::EndChild();
ImGui::EndTabItem();
}
}

View File

@ -20,23 +20,6 @@ namespace big
ImGui::Checkbox("God Mode", &g.vehicle.god_mode);
ImGui::SameLine();
if (ImGui::Button("Bring Personal Vehicle"))
{
QUEUE_JOB_BEGIN_CLAUSE()
{
Vector3 location;
if (!blip::get_blip_location(location, 225, 0) && !blip::get_blip_location(location, 226, 0)) return notify::above_map("No personal vehicle found, was it destroyed?");
Vehicle veh = vehicle::get_closest_to_location(location, 2.f);
if (ENTITY::IS_ENTITY_DEAD(veh, false)) return notify::above_map("Invalid vehicle handle...");
location = ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), true);
vehicle::bring(veh, location);
}QUEUE_JOB_END_CLAUSE
}
if (ImGui::Button("Repair"))
{
QUEUE_JOB_BEGIN_CLAUSE()

View File

@ -1,3 +1,4 @@
#pragma once
#include "blip.hpp"
#include "entity.hpp"
#include "notify.hpp"
@ -98,6 +99,11 @@ namespace big::teleport
return true;
}
inline void to_coords(Vector3 location)
{
PED::SET_PED_COORDS_KEEP_VEHICLE(PLAYER::PLAYER_PED_ID(), location.x, location.y, location.z + 1.f);
}
inline bool to_blip(int sprite, int color = -1)
{
Vector3 location;