Feat teleport improv (#292)
This commit is contained in:
parent
1384bd600d
commit
747af10277
@ -66,9 +66,9 @@ namespace big::teleport
|
||||
|
||||
inline bool into_vehicle(Vehicle veh)
|
||||
{
|
||||
if (!veh)
|
||||
if (!ENTITY::IS_ENTITY_A_VEHICLE(veh))
|
||||
{
|
||||
g_notification_service->push_warning("Teleport", "Player is not in a vehicle.");
|
||||
g_notification_service->push_warning("Teleport", "Invalid vehicle handle");
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -112,6 +112,7 @@ namespace big::teleport
|
||||
if (!blip::get_blip_location(location, sprite, color))
|
||||
return false;
|
||||
|
||||
if (sprite == (int)BlipIcons::Waypoint)
|
||||
load_ground_at_3dcoord(location);
|
||||
|
||||
PED::SET_PED_COORDS_KEEP_VEHICLE(self::ped, location.x, location.y, location.z);
|
||||
@ -154,8 +155,10 @@ namespace big::teleport
|
||||
if (to_blip((int)BlipIcons::Circle, (int)BlipColors::Blue)) return true;
|
||||
if (to_blip((int)BlipIcons::CrateDrop)) return true;
|
||||
static const int blips[] = { 1, 57, 128, 129, 130, 143, 144, 145, 146, 271, 286, 287, 288 };
|
||||
for (int i = 0; i < (sizeof(blips) / sizeof(*blips)); i++) {
|
||||
if (to_blip(blips[i], 5)) {
|
||||
for (const auto& blip : blips)
|
||||
{
|
||||
if (to_blip(blip, 5))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,8 @@ namespace big::vehicle
|
||||
|
||||
inline void bring(Vehicle veh, Vector3 location, bool put_in = true)
|
||||
{
|
||||
if (!ENTITY::IS_ENTITY_A_VEHICLE(veh)) return g_notification_service->push_error("Vehicle", "Invalid handle");
|
||||
|
||||
Vector3 vecVehicleLocation = ENTITY::GET_ENTITY_COORDS(veh, true);
|
||||
teleport::load_ground_at_3dcoord(vecVehicleLocation);
|
||||
|
||||
|
@ -6,34 +6,44 @@
|
||||
|
||||
namespace big
|
||||
{
|
||||
void view::teleport() {
|
||||
|
||||
void view::teleport()
|
||||
{
|
||||
ImGui::Text("Blips:");
|
||||
|
||||
components::button("Waypoint", [] {
|
||||
components::button("Waypoint", []
|
||||
{
|
||||
teleport::to_waypoint();
|
||||
});
|
||||
|
||||
components::button("Objective", [] {
|
||||
components::button("Objective", []
|
||||
{
|
||||
teleport::to_objective();
|
||||
});
|
||||
|
||||
ImGui::Text("Vehicles:");
|
||||
|
||||
components::button("Bring Personal Vehicle", [] {
|
||||
components::button("Teleport to Last Vehicle", []
|
||||
{
|
||||
if (g_local_player && g_local_player->m_vehicle)
|
||||
{
|
||||
const Vehicle veh = g_pointers->m_ptr_to_handle(g_local_player->m_vehicle);
|
||||
|
||||
teleport::into_vehicle(veh);
|
||||
}
|
||||
});
|
||||
|
||||
components::button("Bring Personal Vehicle", []
|
||||
{
|
||||
Vehicle veh = globals::get_personal_vehicle();
|
||||
if (ENTITY::IS_ENTITY_DEAD(veh, false)) return g_notification_service->push_error("Teleport", "Invalid vehicle handle...");
|
||||
|
||||
vehicle::bring(veh, self::pos);
|
||||
});
|
||||
|
||||
components::button("Teleport to Personal Vehicle", [] {
|
||||
components::button("Teleport to Personal Vehicle", []
|
||||
{
|
||||
Vehicle veh = globals::get_personal_vehicle();
|
||||
if (ENTITY::IS_ENTITY_DEAD(veh, false)) return g_notification_service->push_error("Teleport", "Invalid vehicle handle...");
|
||||
|
||||
teleport::to_coords(
|
||||
ENTITY::GET_ENTITY_COORDS(veh, true)
|
||||
);
|
||||
teleport::into_vehicle(veh);
|
||||
});
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user