feat(Vehicle): drive on water (#140)

This commit is contained in:
Maddy 2022-05-02 15:31:07 -04:00 committed by GitHub
parent 98c5596864
commit d1749da34a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 71 additions and 0 deletions

View File

@ -82,6 +82,7 @@ namespace big
QUEUE_JOB_BEGIN_CLAUSE()
{
looped::vehicle_despawn_bypass();
looped::vehicle_drive_on_water();
looped::vehicle_god_mode();
looped::vehicle_horn_boost();
looped::vehicle_is_targetable();

View File

@ -32,6 +32,7 @@ namespace big
static void system_update_pointers();
static void vehicle_despawn_bypass();
static void vehicle_drive_on_water();
static void vehicle_god_mode();
static void vehicle_horn_boost();
static void vehicle_is_targetable();

View File

@ -0,0 +1,65 @@
#include "backend/looped/looped.hpp"
#include "natives.hpp"
#include "script.hpp"
#include "util/entity.hpp"
namespace big
{
void looped::vehicle_drive_on_water()
{
if (g->vehicle.drive_on_water) {
Player player = PLAYER::PLAYER_ID();
Ped playerPed = PLAYER::PLAYER_PED_ID();
Vehicle veh = PED::GET_VEHICLE_PED_IS_IN(playerPed, 0);
DWORD model = ENTITY::GET_ENTITY_MODEL(veh);
Vector3 pos = ENTITY::GET_ENTITY_COORDS(playerPed, 0);
Hash hash = MISC::GET_HASH_KEY("prop_container_ld2");
float height = 0;
WATER::SET_DEEP_OCEAN_SCALER(height);
if ((!(VEHICLE::IS_THIS_MODEL_A_PLANE(ENTITY::GET_ENTITY_MODEL(veh)))) && WATER::GET_WATER_HEIGHT_NO_WAVES(pos.x, pos.y, pos.z, &height)) {
Object container = OBJECT::GET_CLOSEST_OBJECT_OF_TYPE(pos.x, pos.y, pos.z, 4.0, hash, 0, 0, 1);
if (ENTITY::DOES_ENTITY_EXIST(container) && height > -50.0f) {
Vector3 pRot = ENTITY::GET_ENTITY_ROTATION(playerPed, 0);
if (PED::IS_PED_IN_ANY_VEHICLE(playerPed, 1)) pRot = ENTITY::GET_ENTITY_ROTATION(veh, 0);
entity::take_control_of(container);
ENTITY::SET_ENTITY_COORDS(container, pos.x, pos.y, height - 2.5f, 0, 0, 0, 1);
ENTITY::SET_ENTITY_ROTATION(container, 0, 0, pRot.z, 0, 1);
Vector3 containerCoords = ENTITY::GET_ENTITY_COORDS(container, 1);
if (pos.z < containerCoords.z) {
if (!PED::IS_PED_IN_ANY_VEHICLE(playerPed, 0)) {
ENTITY::SET_ENTITY_COORDS(playerPed, pos.x, pos.y, containerCoords.z + 2.0f, 0, 0, 0, 1);
}
else {
entity::take_control_of(veh);
Vector3 vehc = ENTITY::GET_ENTITY_COORDS(veh, 1);
ENTITY::SET_ENTITY_COORDS(veh, vehc.x, vehc.y, containerCoords.z + 2.0f, 0, 0, 0, 1);
}
}
}
else {
Hash model = hash;
STREAMING::REQUEST_MODEL(model);
while (!STREAMING::HAS_MODEL_LOADED(model)) script::get_current()->yield(0ms);
container = OBJECT::CREATE_OBJECT(model, pos.x, pos.y, pos.z, 1, 1, 0);
entity::take_control_of(container);
ENTITY::FREEZE_ENTITY_POSITION(container, 1);
ENTITY::SET_ENTITY_ALPHA(container, 0, 1);
ENTITY::SET_ENTITY_VISIBLE(container, false, 0);
}
}
else {
Object container = OBJECT::GET_CLOSEST_OBJECT_OF_TYPE(pos.x, pos.y, pos.z, 4.0, hash, 0, 0, 1);
if (ENTITY::DOES_ENTITY_EXIST(container)) {
entity::take_control_of(container);
ENTITY::SET_ENTITY_COORDS(container, 0, 0, -1000.0f, 0, 0, 0, 1);
script::get_current()->yield(10ms);
ENTITY::SET_ENTITY_AS_NO_LONGER_NEEDED(&container);
ENTITY::DELETE_ENTITY(&container);
WATER::RESET_DEEP_OCEAN_SCALER();
}
}
}
}
}

View File

@ -182,6 +182,7 @@ namespace big
bool left_side = false;
};
bool drive_on_water = false;
bool god_mode = false;
bool horn_boost = false;
bool is_targetable = true;
@ -404,6 +405,7 @@ namespace big
this->spoofing.rockstar_id = j["spoofing"]["rockstar_id"];
this->spoofing.username = j["spoofing"]["username"];
this->vehicle.drive_on_water = j["vehicle"]["drive_on_water"];
this->vehicle.god_mode = j["vehicle"]["god_mode"];
this->vehicle.horn_boost = j["vehicle"]["horn_boost"];
this->vehicle.is_targetable = j["vehicle"]["is_targetable"];
@ -594,6 +596,7 @@ namespace big
},
{
"vehicle", {
{ "drive_on_water", this->vehicle.drive_on_water },
{ "god_mode", this->vehicle.god_mode },
{ "horn_boost", this->vehicle.horn_boost },
{ "is_targetable", this->vehicle.is_targetable },

View File

@ -13,6 +13,7 @@ namespace big
ImGui::Checkbox("Can Be Targeted", &g->vehicle.is_targetable);
ImGui::Checkbox("God Mode", &g->vehicle.god_mode);
ImGui::Checkbox("Horn Boost", &g->vehicle.horn_boost);
ImGui::Checkbox("Drive On Water", &g->vehicle.drive_on_water);
ImGui::EndGroup();
ImGui::SameLine();