Merge pull request #209 from xM4ddy/vehicle-fly

feat(Vehicle): Added Vehicle Fly
This commit is contained in:
Maddy 2022-05-16 03:41:36 -04:00 committed by GitHub
commit 58af35a6c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 203 additions and 15 deletions

View File

@ -88,6 +88,7 @@ namespace big
looped::vehicle_auto_drive(); looped::vehicle_auto_drive();
looped::vehicle_despawn_bypass(); looped::vehicle_despawn_bypass();
looped::vehicle_drive_on_water(); looped::vehicle_drive_on_water();
looped::vehicle_fly();
looped::vehicle_god_mode(); looped::vehicle_god_mode();
looped::vehicle_horn_boost(); looped::vehicle_horn_boost();
looped::vehicle_instant_brake(); looped::vehicle_instant_brake();

View File

@ -38,6 +38,7 @@ namespace big
static void vehicle_auto_drive(); static void vehicle_auto_drive();
static void vehicle_despawn_bypass(); static void vehicle_despawn_bypass();
static void vehicle_drive_on_water(); static void vehicle_drive_on_water();
static void vehicle_fly();
static void vehicle_god_mode(); static void vehicle_god_mode();
static void vehicle_horn_boost(); static void vehicle_horn_boost();
static void vehicle_instant_brake(); static void vehicle_instant_brake();

View File

@ -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;
}
}
}
}

View File

@ -70,7 +70,7 @@ namespace big
pair net_array_error{}; pair net_array_error{};
pair network_player_mgr_shutdown{}; pair network_player_mgr_shutdown{};
struct struct
{ {
bool above_map = true; bool above_map = true;
bool log = false; bool log = false;
@ -150,9 +150,9 @@ namespace big
int local_weather = 0; int local_weather = 0;
bool override_time = {}; bool override_time = {};
bool override_weather = false; bool override_weather = false;
struct struct
{ {
int hour{}, minute{}, second{}; int hour{}, minute{}, second{};
} custom_time; } custom_time;
}; };
@ -172,7 +172,7 @@ namespace big
bool preview_vehicle = false; bool preview_vehicle = false;
bool spawn_inside = false; bool spawn_inside = false;
bool spawn_maxed = false; bool spawn_maxed = false;
}; };
struct spoofing struct spoofing
{ {
@ -196,6 +196,15 @@ namespace big
bool left_side = false; 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_to_waypoint = false;
bool auto_drive_wander = false; bool auto_drive_wander = false;
int auto_drive_speed = 1; int auto_drive_speed = 1;
@ -210,6 +219,7 @@ namespace big
bool pv_teleport_into = false; bool pv_teleport_into = false;
int rainbow_paint = 0; int rainbow_paint = 0;
speedo_meter speedo_meter{}; speedo_meter speedo_meter{};
fly fly{};
}; };
struct weapons { struct weapons {
@ -470,6 +480,12 @@ namespace big
this->vehicle.speedo_meter.x = j["vehicle"]["speedo_meter"]["position_x"]; this->vehicle.speedo_meter.x = j["vehicle"]["speedo_meter"]["position_x"];
this->vehicle.speedo_meter.y = j["vehicle"]["speedo_meter"]["position_y"]; 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.custom_weapon = (CustomWeapon)j["weapons"]["custom_weapon"];
this->weapons.force_crosshairs = j["weapons"]["force_crosshairs"]; this->weapons.force_crosshairs = j["weapons"]["force_crosshairs"];
this->weapons.infinite_ammo = j["weapons"]["infinite_ammo"]; this->weapons.infinite_ammo = j["weapons"]["infinite_ammo"];
@ -693,7 +709,17 @@ namespace big
{ "type", (int)this->vehicle.speedo_meter.type }, { "type", (int)this->vehicle.speedo_meter.type },
{ "left_side", this->vehicle.speedo_meter.left_side }, { "left_side", this->vehicle.speedo_meter.left_side },
{ "position_x", this->vehicle.speedo_meter.x }, { "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", { { "ammo_special", {
{ "toggle", this->weapons.ammo_special.toggle }, { "toggle", this->weapons.ammo_special.toggle },
{ "type", (int)this->weapons.ammo_special.type }, { "type", (int)this->weapons.ammo_special.type },
} }
}, },
{ "custom_weapon", (int)this->weapons.custom_weapon }, { "custom_weapon", (int)this->weapons.custom_weapon },
@ -775,7 +800,7 @@ namespace big
if (deep_compare(this->options, j, true)) if (deep_compare(this->options, j, true))
this->save(); this->save();
} }
bool load() bool load()
{ {
this->default_options = this->to_json(); this->default_options = this->to_json();

View File

@ -23,15 +23,15 @@ namespace big
components::button("Repair", [] { components::button("Repair", [] {
vehicle::repair(self::veh); vehicle::repair(self::veh);
}); });
components::button("Instant in personal vehicle", [] { 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"); 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(); vehicle::go_into_personal_vehicle();
}); });
if (ImGui::TreeNode("Paint")) if (ImGui::TreeNode("Paint"))
{ {
ImGui::ListBox("RGB Type", &g->vehicle.rainbow_paint, vehicle::rgb_types, 3); ImGui::ListBox("RGB Type", &g->vehicle.rainbow_paint, vehicle::rgb_types, 3);
@ -53,12 +53,12 @@ namespace big
components::button("Drive To Waypoint", [] { components::button("Drive To Waypoint", [] {
g->vehicle.auto_drive_to_waypoint = true; g->vehicle.auto_drive_to_waypoint = true;
}); });
components::button("Wander", [] { components::button("Wander", [] {
g->vehicle.auto_drive_wander = true; g->vehicle.auto_drive_wander = true;
}); });
ImGui::SliderInt("Top Speed", &g->vehicle.auto_drive_speed, 1, 200); ImGui::SliderInt("Top Speed", &g->vehicle.auto_drive_speed, 1, 200);
@ -73,7 +73,7 @@ namespace big
TASK::CLEAR_PED_TASKS(self::ped); TASK::CLEAR_PED_TASKS(self::ped);
} }
QUEUE_JOB_END_CLAUSE QUEUE_JOB_END_CLAUSE
}); });
if (ImGui::ListBox("Driving Style", &g->vehicle.driving_style_id, vehicle::driving_style_names, 3)) if (ImGui::ListBox("Driving Style", &g->vehicle.driving_style_id, vehicle::driving_style_names, 3))
{ {
@ -83,6 +83,20 @@ namespace big
ImGui::Separator(); 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::small_text("LS Customs");
components::button("Start LS Customs", [] { components::button("Start LS Customs", [] {