From f1604fede67d5bebf44350d6c54510439a5d0822 Mon Sep 17 00:00:00 2001 From: xM4ddy Date: Mon, 16 May 2022 02:22:11 -0400 Subject: [PATCH] Added Vehicle Fly --- BigBaseV2/src/backend/backend.cpp | 1 + BigBaseV2/src/backend/looped/looped.hpp | 1 + BigBaseV2/src/backend/looped/vehicle/fly.cpp | 147 +++++++++++++++++++ BigBaseV2/src/core/globals.hpp | 39 ++++- BigBaseV2/src/views/vehicle/view_vehicle.cpp | 30 +++- 5 files changed, 203 insertions(+), 15 deletions(-) create mode 100644 BigBaseV2/src/backend/looped/vehicle/fly.cpp diff --git a/BigBaseV2/src/backend/backend.cpp b/BigBaseV2/src/backend/backend.cpp index ef168a71..b80709f0 100644 --- a/BigBaseV2/src/backend/backend.cpp +++ b/BigBaseV2/src/backend/backend.cpp @@ -88,6 +88,7 @@ namespace big looped::vehicle_auto_drive(); looped::vehicle_despawn_bypass(); looped::vehicle_drive_on_water(); + looped::vehicle_fly(); looped::vehicle_god_mode(); looped::vehicle_horn_boost(); looped::vehicle_instant_brake(); diff --git a/BigBaseV2/src/backend/looped/looped.hpp b/BigBaseV2/src/backend/looped/looped.hpp index a08a13a7..72dd3664 100644 --- a/BigBaseV2/src/backend/looped/looped.hpp +++ b/BigBaseV2/src/backend/looped/looped.hpp @@ -38,6 +38,7 @@ namespace big static void vehicle_auto_drive(); static void vehicle_despawn_bypass(); static void vehicle_drive_on_water(); + static void vehicle_fly(); static void vehicle_god_mode(); static void vehicle_horn_boost(); static void vehicle_instant_brake(); diff --git a/BigBaseV2/src/backend/looped/vehicle/fly.cpp b/BigBaseV2/src/backend/looped/vehicle/fly.cpp new file mode 100644 index 00000000..41bed528 --- /dev/null +++ b/BigBaseV2/src/backend/looped/vehicle/fly.cpp @@ -0,0 +1,147 @@ +#include "backend/looped/looped.hpp" +#include "natives.hpp" +#include "util/entity.hpp" + +namespace big +{ + + static bool last_fly_tick = false; + + void do_vehicle_fly() + { + Vector3 cam_pos = CAM::GET_GAMEPLAY_CAM_ROT(0); + ENTITY::SET_ENTITY_ROTATION(self::veh, cam_pos.x, cam_pos.y, cam_pos.z, 1, true); + ENTITY::SET_ENTITY_COLLISION(self::veh, !g->vehicle.fly.no_collision, true); + + float locspeed = (g->vehicle.fly.speed * 10); + float locspeed2 = g->vehicle.fly.speed; + + if (PAD::IS_CONTROL_PRESSED(0, 61)) + { + locspeed = (locspeed * 2); + locspeed2 = (locspeed2 * 2); + } + + + if (PAD::IS_CONTROL_PRESSED(2, 71)) + { + if (g->vehicle.fly.dont_stop) + { + ENTITY::APPLY_FORCE_TO_ENTITY(self::veh, 1, 0.0, g->vehicle.fly.speed, 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1); + } + else + { + VEHICLE::SET_VEHICLE_FORWARD_SPEED(self::veh, locspeed); + } + } + + if (PAD::IS_CONTROL_PRESSED(2, 72)) + { + float lsp = g->vehicle.fly.speed; + if (!PAD::IS_CONTROL_PRESSED(0, 61)) + { + lsp = (g->vehicle.fly.speed * 2); + } + if (g->vehicle.fly.dont_stop) + { + ENTITY::APPLY_FORCE_TO_ENTITY(self::veh, 1, 0.0, 0 - (lsp), 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1); + } + else + { + VEHICLE::SET_VEHICLE_FORWARD_SPEED(self::veh, (0 - locspeed)); + } + } + + if (PAD::IS_CONTROL_PRESSED(2, 63)) + { + float lsp = ((0 - g->vehicle.fly.speed) * 2); + if (!PAD::IS_CONTROL_PRESSED(0, 61)) + { + lsp = (0 - g->vehicle.fly.speed); + } + if (g->vehicle.fly.dont_stop) + { + ENTITY::APPLY_FORCE_TO_ENTITY(self::veh, 1, (lsp), 0.0, 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1); + } + else + { + ENTITY::APPLY_FORCE_TO_ENTITY(self::veh, 1, (0 - (locspeed)), 0.0, 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1); + } + } + + if (PAD::IS_CONTROL_PRESSED(2, 64)) + { + float lsp = g->vehicle.fly.speed; + if (!PAD::IS_CONTROL_PRESSED(0, 61)) + { + lsp = (g->vehicle.fly.speed * 2); + } + if (g->vehicle.fly.dont_stop) + { + ENTITY::APPLY_FORCE_TO_ENTITY(self::veh, 1, lsp, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1); + } + else + { + ENTITY::APPLY_FORCE_TO_ENTITY(self::veh, 1, locspeed, 0.0, 0.0, 0.0, 0.0, 0.0, 0, 1, 1, 1, 0, 1); + } + } + + if (!g->vehicle.fly.dont_stop && !PAD::IS_CONTROL_PRESSED(2, 71) && !PAD::IS_CONTROL_PRESSED(2, 72)) + { + VEHICLE::SET_VEHICLE_FORWARD_SPEED(self::veh, 0.0); + } + + if (TASK::GET_IS_TASK_ACTIVE(self::ped, 2)) + { + g->vehicle.fly.enabled = false; + VEHICLE::SET_VEHICLE_GRAVITY(self::veh, true); + ENTITY::SET_ENTITY_COLLISION(self::veh, true, true); + if (g->vehicle.fly.stop_on_exit) + { + VEHICLE::SET_VEHICLE_FORWARD_SPEED(self::veh, 0.0); + } + } + } + + void looped::vehicle_fly() + { + if (g->vehicle.fly.enabled) + { + + last_fly_tick = true; + + if (!self::veh) + { + g_notification_service->push_warning("Warning", "Please be in a vehicle before enabling vehicle fly."); + g->vehicle.fly.enabled = false; + return; + } + else + { + if (NETWORK::NETWORK_HAS_CONTROL_OF_ENTITY(self::veh)) + { + do_vehicle_fly(); + VEHICLE::SET_VEHICLE_GRAVITY(self::veh, false); + } + else + { + for (int i = 0; i < 5; i++) + { + entity::take_control_of(self::veh); + g_notification_service->push_warning("Warning", "Failed to take control of the vehicle."); + } + + } + } + } + else + { + if (last_fly_tick) + { + ENTITY::SET_ENTITY_COLLISION(self::veh, true, true); + VEHICLE::SET_VEHICLE_GRAVITY(self::veh, true); + last_fly_tick = false; + } + } + } +} diff --git a/BigBaseV2/src/core/globals.hpp b/BigBaseV2/src/core/globals.hpp index a3947905..44796fde 100644 --- a/BigBaseV2/src/core/globals.hpp +++ b/BigBaseV2/src/core/globals.hpp @@ -70,7 +70,7 @@ namespace big pair net_array_error{}; pair network_player_mgr_shutdown{}; - struct + struct { bool above_map = true; bool log = false; @@ -150,9 +150,9 @@ namespace big int local_weather = 0; bool override_time = {}; bool override_weather = false; - struct + struct { - int hour{}, minute{}, second{}; + int hour{}, minute{}, second{}; } custom_time; }; @@ -172,7 +172,7 @@ namespace big bool preview_vehicle = false; bool spawn_inside = false; bool spawn_maxed = false; - }; + }; struct spoofing { @@ -196,6 +196,15 @@ namespace big bool left_side = false; }; + struct fly + { + bool dont_stop = false; + bool enabled = false; + bool no_collision = false; + bool stop_on_exit = false; + float speed = 1; + }; + bool auto_drive_to_waypoint = false; bool auto_drive_wander = false; int auto_drive_speed = 1; @@ -210,6 +219,7 @@ namespace big bool pv_teleport_into = false; int rainbow_paint = 0; speedo_meter speedo_meter{}; + fly fly{}; }; struct weapons { @@ -470,6 +480,12 @@ namespace big this->vehicle.speedo_meter.x = j["vehicle"]["speedo_meter"]["position_x"]; this->vehicle.speedo_meter.y = j["vehicle"]["speedo_meter"]["position_y"]; + this->vehicle.fly.dont_stop = j["vehicle"]["fly"]["dont_stop"]; + this->vehicle.fly.enabled = j["vehicle"]["fly"]["enabled"]; + this->vehicle.fly.no_collision = j["vehicle"]["fly"]["no_collision"]; + this->vehicle.fly.speed = j["vehicle"]["fly"]["speed"]; + this->vehicle.fly.stop_on_exit = j["vehicle"]["fly"]["stop_on_exit"]; + this->weapons.custom_weapon = (CustomWeapon)j["weapons"]["custom_weapon"]; this->weapons.force_crosshairs = j["weapons"]["force_crosshairs"]; this->weapons.infinite_ammo = j["weapons"]["infinite_ammo"]; @@ -693,7 +709,17 @@ namespace big { "type", (int)this->vehicle.speedo_meter.type }, { "left_side", this->vehicle.speedo_meter.left_side }, { "position_x", this->vehicle.speedo_meter.x }, - { "position_y", this->vehicle.speedo_meter.y } + { "position_y", this->vehicle.speedo_meter.y }, + } + }, + { + "fly", + { + { "no_collision", this->vehicle.fly.no_collision }, + { "dont_stop", this->vehicle.fly.dont_stop }, + { "enabled", this->vehicle.fly.enabled }, + { "stop_on_exit", this->vehicle.fly.stop_on_exit }, + { "speed", this->vehicle.fly.speed }, } } } @@ -703,7 +729,6 @@ namespace big { "ammo_special", { { "toggle", this->weapons.ammo_special.toggle }, { "type", (int)this->weapons.ammo_special.type }, - } }, { "custom_weapon", (int)this->weapons.custom_weapon }, @@ -775,7 +800,7 @@ namespace big if (deep_compare(this->options, j, true)) this->save(); } - + bool load() { this->default_options = this->to_json(); diff --git a/BigBaseV2/src/views/vehicle/view_vehicle.cpp b/BigBaseV2/src/views/vehicle/view_vehicle.cpp index 113373b5..62909064 100644 --- a/BigBaseV2/src/views/vehicle/view_vehicle.cpp +++ b/BigBaseV2/src/views/vehicle/view_vehicle.cpp @@ -23,15 +23,15 @@ namespace big components::button("Repair", [] { vehicle::repair(self::veh); - }); - + }); + components::button("Instant in personal vehicle", [] { if (!*g_pointers->m_is_session_started) return g_notification_service->push_warning("WARNING", "Go into GTA V Online to use this option"); vehicle::go_into_personal_vehicle(); - - }); - + + }); + if (ImGui::TreeNode("Paint")) { ImGui::ListBox("RGB Type", &g->vehicle.rainbow_paint, vehicle::rgb_types, 3); @@ -53,12 +53,12 @@ namespace big components::button("Drive To Waypoint", [] { g->vehicle.auto_drive_to_waypoint = true; - }); + }); components::button("Wander", [] { g->vehicle.auto_drive_wander = true; - }); + }); ImGui::SliderInt("Top Speed", &g->vehicle.auto_drive_speed, 1, 200); @@ -73,7 +73,7 @@ namespace big TASK::CLEAR_PED_TASKS(self::ped); } QUEUE_JOB_END_CLAUSE - }); + }); if (ImGui::ListBox("Driving Style", &g->vehicle.driving_style_id, vehicle::driving_style_names, 3)) { @@ -83,6 +83,20 @@ namespace big ImGui::Separator(); + components::small_text("Vehicle Fly"); + + ImGui::Checkbox("Enabled", &g->vehicle.fly.enabled); + ImGui::SameLine(); + ImGui::Checkbox("Disable Collision", &g->vehicle.fly.no_collision); + + ImGui::Checkbox("Don't Stop", &g->vehicle.fly.dont_stop); + ImGui::SameLine(); + ImGui::Checkbox("Stop On Exit", &g->vehicle.fly.stop_on_exit); + + ImGui::SliderFloat("Speed", &g->vehicle.fly.speed, 1.f, 100.f, "%.0f", 1); + + ImGui::Separator(); + components::small_text("LS Customs"); components::button("Start LS Customs", [] {