mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2024-12-22 20:17:24 +08:00
Added ownership checks to the delete_vehicle check. (#3552)
* Added ownership checks to the delete_vehicle check. * Redesigned delete_vehicle protections. * Cleaned up code. * Fixed vehicle repaired/vehicle godmode code not running if the player was offline/did not have a personal vehicle deployed. * Fixed Chinese being a simp. (Closes #3581) * GTAV-Classes: bump version
This commit is contained in:
parent
d1e4b0830c
commit
bdb307125f
@ -3,7 +3,7 @@ include(FetchContent)
|
|||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
gtav_classes
|
gtav_classes
|
||||||
GIT_REPOSITORY https://github.com/Yimura/GTAV-Classes.git
|
GIT_REPOSITORY https://github.com/Yimura/GTAV-Classes.git
|
||||||
GIT_TAG b9b832ab00c95a731f8472f696c5d026a29fd767
|
GIT_TAG aebd69542e58fab8975da76c3e555b122ddef5d6
|
||||||
GIT_PROGRESS TRUE
|
GIT_PROGRESS TRUE
|
||||||
CONFIGURE_COMMAND ""
|
CONFIGURE_COMMAND ""
|
||||||
BUILD_COMMAND ""
|
BUILD_COMMAND ""
|
||||||
|
@ -18,9 +18,12 @@ namespace big
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!entity::take_control_of(veh, 0))
|
if (*g_pointers->m_gta.m_is_session_started)
|
||||||
{
|
{
|
||||||
return;
|
if (!entity::take_control_of(veh, 0))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (VEHICLE::GET_DOES_VEHICLE_HAVE_DAMAGE_DECALS(veh))
|
if (VEHICLE::GET_DOES_VEHICLE_HAVE_DAMAGE_DECALS(veh))
|
||||||
|
@ -1,135 +1,126 @@
|
|||||||
#include "backend/looped/looped.hpp"
|
#include "backend/looped/looped.hpp"
|
||||||
#include "backend/looped_command.hpp"
|
#include "backend/looped_command.hpp"
|
||||||
#include "natives.hpp"
|
#include "natives.hpp"
|
||||||
#include "util/mobile.hpp"
|
#include "util/mobile.hpp"
|
||||||
|
|
||||||
namespace big
|
namespace big
|
||||||
{
|
{
|
||||||
class vehicle_godmode_internal : looped_command
|
class vehicle_godmode_internal : looped_command
|
||||||
{
|
{
|
||||||
using looped_command::looped_command;
|
using looped_command::looped_command;
|
||||||
|
|
||||||
static constexpr uint8_t deform_god_bit = 1 << 4;
|
static constexpr uint8_t deform_god_bit = 1 << 4;
|
||||||
|
|
||||||
struct orig_veh_data
|
struct orig_veh_data
|
||||||
{
|
{
|
||||||
uint8_t m_deform_god = 0;
|
uint8_t m_deform_god = 0;
|
||||||
uint32_t m_damage_bits = 0;
|
uint32_t m_damage_bits = 0;
|
||||||
uint32_t m_last_damage_bits = 0;
|
uint32_t m_last_damage_bits = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::unordered_map<CVehicle*, orig_veh_data> m_orig_veh_datas;
|
std::unordered_map<CVehicle*, orig_veh_data> m_orig_veh_datas;
|
||||||
|
|
||||||
void restore_original_vehicle_data(CVehicle* vehicle)
|
void restore_original_vehicle_data(CVehicle* vehicle)
|
||||||
{
|
{
|
||||||
if (m_orig_veh_datas.contains(vehicle))
|
if (m_orig_veh_datas.contains(vehicle))
|
||||||
{
|
{
|
||||||
vehicle->m_deform_god = m_orig_veh_datas[vehicle].m_deform_god;
|
vehicle->m_deform_god = m_orig_veh_datas[vehicle].m_deform_god;
|
||||||
vehicle->m_damage_bits = m_orig_veh_datas[vehicle].m_damage_bits;
|
vehicle->m_damage_bits = m_orig_veh_datas[vehicle].m_damage_bits;
|
||||||
|
|
||||||
m_orig_veh_datas.erase(vehicle);
|
m_orig_veh_datas.erase(vehicle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool restore_vehicle_data_when_leaving_it(CVehicle* vehicle)
|
bool restore_vehicle_data_when_leaving_it(CVehicle* vehicle)
|
||||||
{
|
{
|
||||||
const auto is_not_in_vehicle = !PED::GET_PED_CONFIG_FLAG(self::ped, 62, false);
|
const auto is_not_in_vehicle = !PED::GET_PED_CONFIG_FLAG(self::ped, 62, false);
|
||||||
if (is_not_in_vehicle)
|
if (is_not_in_vehicle)
|
||||||
{
|
{
|
||||||
restore_original_vehicle_data(vehicle);
|
restore_original_vehicle_data(vehicle);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void save_original_veh_data(CVehicle* vehicle)
|
void save_original_veh_data(CVehicle* vehicle)
|
||||||
{
|
{
|
||||||
if (!m_orig_veh_datas.contains(vehicle))
|
if (!m_orig_veh_datas.contains(vehicle))
|
||||||
{
|
{
|
||||||
m_orig_veh_datas[vehicle].m_deform_god = vehicle->m_deform_god;
|
m_orig_veh_datas[vehicle].m_deform_god = vehicle->m_deform_god;
|
||||||
m_orig_veh_datas[vehicle].m_damage_bits = vehicle->m_damage_bits;
|
m_orig_veh_datas[vehicle].m_damage_bits = vehicle->m_damage_bits;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void apply_godmode_to_vehicle(CVehicle* vehicle, bool personal_vehicle = false)
|
void apply_godmode_to_vehicle(CVehicle* vehicle, bool personal_vehicle = false)
|
||||||
{
|
{
|
||||||
if (vehicle == nullptr)
|
if (vehicle == nullptr)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!personal_vehicle)
|
if (!personal_vehicle)
|
||||||
{
|
{
|
||||||
if (restore_vehicle_data_when_leaving_it(vehicle))
|
if (restore_vehicle_data_when_leaving_it(vehicle))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
save_original_veh_data(vehicle);
|
save_original_veh_data(vehicle);
|
||||||
|
|
||||||
if (g.vehicle.god_mode || g.vehicle.proof_collision)
|
if (g.vehicle.god_mode || g.vehicle.proof_collision)
|
||||||
{
|
{
|
||||||
vehicle->m_deform_god &= ~(deform_god_bit);
|
vehicle->m_deform_god &= ~(deform_god_bit);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
vehicle->m_deform_god |= deform_god_bit;
|
vehicle->m_deform_god |= deform_god_bit;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t bits = g.vehicle.proof_mask;
|
uint32_t bits = g.vehicle.proof_mask;
|
||||||
uint32_t changed_bits = bits ^ m_orig_veh_datas[vehicle].m_last_damage_bits;
|
uint32_t changed_bits = bits ^ m_orig_veh_datas[vehicle].m_last_damage_bits;
|
||||||
uint32_t changed_or_enabled_bits = bits | changed_bits;
|
uint32_t changed_or_enabled_bits = bits | changed_bits;
|
||||||
|
|
||||||
if (changed_or_enabled_bits)
|
if (changed_or_enabled_bits)
|
||||||
{
|
{
|
||||||
uint32_t unchanged_bits = vehicle->m_damage_bits & ~changed_or_enabled_bits;
|
uint32_t unchanged_bits = vehicle->m_damage_bits & ~changed_or_enabled_bits;
|
||||||
vehicle->m_damage_bits = unchanged_bits | bits;
|
vehicle->m_damage_bits = unchanged_bits | bits;
|
||||||
m_orig_veh_datas[vehicle].m_last_damage_bits = bits;
|
m_orig_veh_datas[vehicle].m_last_damage_bits = bits;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CVehicle* get_personal_vehicle()
|
virtual void on_tick() override
|
||||||
{
|
{
|
||||||
Vehicle personal_vehicle = mobile::mechanic::get_personal_vehicle();
|
if (g_local_player)
|
||||||
if (ENTITY::DOES_ENTITY_EXIST(personal_vehicle))
|
{
|
||||||
{
|
const auto personal_vehicle = mobile::mechanic::get_personal_cvehicle();
|
||||||
return reinterpret_cast<CVehicle*>(g_pointers->m_gta.m_handle_to_ptr(personal_vehicle));
|
if (personal_vehicle)
|
||||||
}
|
{
|
||||||
|
apply_godmode_to_vehicle(personal_vehicle, true);
|
||||||
return nullptr;
|
}
|
||||||
}
|
apply_godmode_to_vehicle(g_local_player->m_vehicle, personal_vehicle == g_local_player->m_vehicle);
|
||||||
|
}
|
||||||
virtual void on_tick() override
|
}
|
||||||
{
|
|
||||||
if (g_local_player)
|
virtual void on_disable() override
|
||||||
{
|
{
|
||||||
const auto personal_vehicle = get_personal_vehicle();
|
if (g_local_player)
|
||||||
apply_godmode_to_vehicle(personal_vehicle, true);
|
{
|
||||||
apply_godmode_to_vehicle(g_local_player->m_vehicle, personal_vehicle == g_local_player->m_vehicle);
|
if (g_local_player->m_vehicle)
|
||||||
}
|
restore_original_vehicle_data(g_local_player->m_vehicle);
|
||||||
}
|
|
||||||
|
if (const auto personal_vehicle = mobile::mechanic::get_personal_cvehicle())
|
||||||
virtual void on_disable() override
|
{
|
||||||
{
|
restore_original_vehicle_data(personal_vehicle);
|
||||||
if (g_local_player)
|
}
|
||||||
{
|
}
|
||||||
if (g_local_player->m_vehicle)
|
}
|
||||||
restore_original_vehicle_data(g_local_player->m_vehicle);
|
};
|
||||||
|
|
||||||
const auto personal_vehicle = get_personal_vehicle();
|
static bool true_ref = true;
|
||||||
if (personal_vehicle)
|
vehicle_godmode_internal g_vehicle_godmode_internal("$$vehgodmode", "", "", true_ref);
|
||||||
{
|
bool_command g_vehicle_godmode("vehgodmode", "VEHICLE_GOD", "VEHICLE_GOD_DESC",
|
||||||
restore_original_vehicle_data(personal_vehicle);
|
g.vehicle.god_mode);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
static bool true_ref = true;
|
|
||||||
vehicle_godmode_internal g_vehicle_godmode_internal("$$vehgodmode", "", "", true_ref);
|
|
||||||
bool_command g_vehicle_godmode("vehgodmode", "VEHICLE_GOD", "VEHICLE_GOD_DESC",
|
|
||||||
g.vehicle.god_mode);
|
|
||||||
}
|
}
|
@ -16,6 +16,6 @@ namespace big
|
|||||||
{eGameLanguage::TRADITIONAL_CHINESE, "Chinese (Traditional)"},
|
{eGameLanguage::TRADITIONAL_CHINESE, "Chinese (Traditional)"},
|
||||||
{eGameLanguage::JAPANESE, "Japanese"},
|
{eGameLanguage::JAPANESE, "Japanese"},
|
||||||
{eGameLanguage::MEXICAN_SPANISH, "Spanish (Mexico)"},
|
{eGameLanguage::MEXICAN_SPANISH, "Spanish (Mexico)"},
|
||||||
{eGameLanguage::SIMPLIFIED_CHINESE, "Chinese (Simpified)"},
|
{eGameLanguage::SIMPLIFIED_CHINESE, "Chinese (Simplified)"},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
#include "hooking/hooking.hpp"
|
#include "hooking/hooking.hpp"
|
||||||
|
#include "util/mobile.hpp"
|
||||||
#include "util/notify.hpp"
|
#include "util/notify.hpp"
|
||||||
|
|
||||||
namespace big
|
namespace big
|
||||||
@ -12,16 +13,40 @@ namespace big
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_local_player && g_local_player->m_vehicle && g_local_player->m_vehicle->m_net_object
|
if (const auto personal_vehicle = mobile::mechanic::get_personal_cvehicle())
|
||||||
&& object_id == g_local_player->m_vehicle->m_net_object->m_object_id) [[unlikely]]
|
|
||||||
{
|
{
|
||||||
if (!NETWORK::NETWORK_IS_ACTIVITY_SESSION()) //If we're in Freemode.
|
if (auto net_obj = personal_vehicle->m_net_object)
|
||||||
{
|
{
|
||||||
if (auto plyr = g_player_service->get_by_id(src->m_player_id))
|
if (object_id == net_obj->m_object_id && entity::network_has_control_of_entity(net_obj))
|
||||||
{
|
{
|
||||||
g.reactions.delete_vehicle.process(plyr);
|
/*LOG(VERBOSE) << "DELETION ORDER FOR PERSONAL VEHICLE: " << net_obj->m_object_id << " m_is_remote: " << net_obj->m_is_remote
|
||||||
|
<< " m_bubble: " << net_obj->m_bubble << " m_owner_id: " << net_obj->m_owner_id
|
||||||
|
<< " m_wants_to_be_owner: " << net_obj->m_wants_to_be_owner;*/
|
||||||
|
if (auto plyr = g_player_service->get_by_id(src->m_player_id))
|
||||||
|
{
|
||||||
|
g.reactions.delete_vehicle.process(plyr);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (self::veh != 0)
|
||||||
|
{
|
||||||
|
if (const auto current_vehicle = g_local_player->m_vehicle)
|
||||||
|
{
|
||||||
|
auto net_obj = current_vehicle->m_net_object;
|
||||||
|
if (object_id == net_obj->m_object_id && entity::network_has_control_of_entity(net_obj))
|
||||||
|
{
|
||||||
|
/*LOG(VERBOSE) << "DELETION ORDER FOR CURRENT VEHICLE: " << net_obj->m_object_id
|
||||||
|
<< " m_is_remote: " << net_obj->m_is_remote << " m_bubble: " << net_obj->m_bubble
|
||||||
|
<< " m_owner_id: " << net_obj->m_owner_id << " m_wants_to_be_owner: " << net_obj->m_wants_to_be_owner;*/
|
||||||
|
if (auto plyr = g_player_service->get_by_id(src->m_player_id))
|
||||||
|
{
|
||||||
|
g.reactions.delete_vehicle.process(plyr);
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ namespace big::entity
|
|||||||
|
|
||||||
bool network_has_control_of_entity(rage::netObject* net_object)
|
bool network_has_control_of_entity(rage::netObject* net_object)
|
||||||
{
|
{
|
||||||
return !net_object || !net_object->m_next_owner_id && (net_object->m_control_id == -1);
|
return !net_object || !net_object->m_is_remote && (net_object->m_wants_to_be_owner == -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool take_control_of(Entity ent, int timeout)
|
bool take_control_of(Entity ent, int timeout)
|
||||||
|
@ -1,217 +1,228 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "core/enums.hpp"
|
#include "core/enums.hpp"
|
||||||
#include "core/scr_globals.hpp"
|
#include "core/scr_globals.hpp"
|
||||||
#include "globals.hpp"
|
#include "globals.hpp"
|
||||||
#include "gta_util.hpp"
|
#include "gta_util.hpp"
|
||||||
#include "misc.hpp"
|
#include "misc.hpp"
|
||||||
#include "natives.hpp"
|
#include "natives.hpp"
|
||||||
#include "notify.hpp"
|
#include "notify.hpp"
|
||||||
#include "script.hpp"
|
#include "script.hpp"
|
||||||
#include "core/scr_globals.hpp"
|
#include "core/scr_globals.hpp"
|
||||||
#include "script_local.hpp"
|
#include "script_local.hpp"
|
||||||
#include "vehicle.hpp"
|
#include "vehicle.hpp"
|
||||||
|
|
||||||
namespace big::mobile
|
namespace big::mobile
|
||||||
{
|
{
|
||||||
namespace util
|
namespace util
|
||||||
{
|
{
|
||||||
int get_current_personal_vehicle(); // forward declare
|
int get_current_personal_vehicle(); // forward declare
|
||||||
inline void despawn_current_personal_vehicle()
|
inline void despawn_current_personal_vehicle()
|
||||||
{
|
{
|
||||||
misc::clear_bits(scr_globals::vehicle_global.at(get_current_personal_vehicle(), 142).at(103).as<int*>(), eVehicleFlags::TRIGGER_SPAWN_TOGGLE);
|
misc::clear_bits(scr_globals::vehicle_global.at(get_current_personal_vehicle(), 142).at(103).as<int*>(), eVehicleFlags::TRIGGER_SPAWN_TOGGLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int get_current_personal_vehicle()
|
inline int get_current_personal_vehicle()
|
||||||
{
|
{
|
||||||
return *scr_globals::stats.at(0, 5568).at(681).at(2).as<int*>();
|
return *scr_globals::stats.at(0, 5568).at(681).at(2).as<int*>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace merry_weather
|
namespace merry_weather
|
||||||
{
|
{
|
||||||
inline void request_ammo_drop()
|
inline void request_ammo_drop()
|
||||||
{
|
{
|
||||||
*scr_globals::freemode_global.at(906).as<int*>() = 1;
|
*scr_globals::freemode_global.at(906).as<int*>() = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void request_boat_pickup()
|
inline void request_boat_pickup()
|
||||||
{
|
{
|
||||||
*scr_globals::freemode_global.at(907).as<int*>() = 1;
|
*scr_globals::freemode_global.at(907).as<int*>() = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void request_helicopter_pickup()
|
inline void request_helicopter_pickup()
|
||||||
{
|
{
|
||||||
*scr_globals::freemode_global.at(908).as<int*>() = 1;
|
*scr_globals::freemode_global.at(908).as<int*>() = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void request_backup_helicopter()
|
inline void request_backup_helicopter()
|
||||||
{
|
{
|
||||||
*scr_globals::freemode_global.at(4506).as<int*>() = 1;
|
*scr_globals::freemode_global.at(4506).as<int*>() = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void request_airstrike()
|
inline void request_airstrike()
|
||||||
{
|
{
|
||||||
*scr_globals::freemode_global.at(4507).as<int*>() = 1;
|
*scr_globals::freemode_global.at(4507).as<int*>() = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace mors_mutual
|
namespace mors_mutual
|
||||||
{
|
{
|
||||||
inline bool fix_index(int veh_idx, bool spawn_veh = false)
|
inline bool fix_index(int veh_idx, bool spawn_veh = false)
|
||||||
{
|
{
|
||||||
bool can_be_fixed = misc::has_bits_set(scr_globals::vehicle_global.at(veh_idx, 142).at(103).as<int*>(), eVehicleFlags::DESTROYED | eVehicleFlags::HAS_INSURANCE);
|
bool can_be_fixed = misc::has_bits_set(scr_globals::vehicle_global.at(veh_idx, 142).at(103).as<int*>(), eVehicleFlags::DESTROYED | eVehicleFlags::HAS_INSURANCE);
|
||||||
|
|
||||||
if (can_be_fixed)
|
if (can_be_fixed)
|
||||||
{
|
{
|
||||||
misc::clear_bits(scr_globals::vehicle_global.at(veh_idx, 142).at(103).as<int*>(), eVehicleFlags::DESTROYED | eVehicleFlags::IMPOUNDED | eVehicleFlags::UNK2);
|
misc::clear_bits(scr_globals::vehicle_global.at(veh_idx, 142).at(103).as<int*>(), eVehicleFlags::DESTROYED | eVehicleFlags::IMPOUNDED | eVehicleFlags::UNK2);
|
||||||
|
|
||||||
if (spawn_veh)
|
if (spawn_veh)
|
||||||
{
|
{
|
||||||
misc::set_bits(scr_globals::vehicle_global.at(veh_idx, 142).at(103).as<int*>(), eVehicleFlags::TRIGGER_SPAWN_TOGGLE | eVehicleFlags::SPAWN_AT_MORS_MUTUAL);
|
misc::set_bits(scr_globals::vehicle_global.at(veh_idx, 142).at(103).as<int*>(), eVehicleFlags::TRIGGER_SPAWN_TOGGLE | eVehicleFlags::SPAWN_AT_MORS_MUTUAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return can_be_fixed;
|
return can_be_fixed;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int fix_all()
|
inline int fix_all()
|
||||||
{
|
{
|
||||||
int fixed_count = 0;
|
int fixed_count = 0;
|
||||||
|
|
||||||
const int arr_size = *scr_globals::vehicle_global.as<int*>();
|
const int arr_size = *scr_globals::vehicle_global.as<int*>();
|
||||||
for (int i = 0; i < arr_size; i++)
|
for (int i = 0; i < arr_size; i++)
|
||||||
if (fix_index(i, true))
|
if (fix_index(i, true))
|
||||||
fixed_count++;
|
fixed_count++;
|
||||||
|
|
||||||
return fixed_count;
|
return fixed_count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ceo_abilities
|
namespace ceo_abilities
|
||||||
{
|
{
|
||||||
inline void request_bullshark_testosterone()
|
inline void request_bullshark_testosterone()
|
||||||
{
|
{
|
||||||
*scr_globals::freemode_properties.at(3733).as<int*>() = 1;
|
*scr_globals::freemode_properties.at(3733).as<int*>() = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void request_ballistic_armor() //i think this is a ceo ability atleast?
|
inline void request_ballistic_armor() //i think this is a ceo ability atleast?
|
||||||
{
|
{
|
||||||
*scr_globals::freemode_global.at(906).as<int*>() = 1;
|
*scr_globals::freemode_global.at(906).as<int*>() = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace services
|
namespace services
|
||||||
{
|
{
|
||||||
inline void request_avenger()
|
inline void request_avenger()
|
||||||
{
|
{
|
||||||
*scr_globals::freemode_global.at(953).as<int*>() = 1;
|
*scr_globals::freemode_global.at(953).as<int*>() = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void request_kosatka()
|
inline void request_kosatka()
|
||||||
{
|
{
|
||||||
*scr_globals::freemode_global.at(975).as<int*>() = 1;
|
*scr_globals::freemode_global.at(975).as<int*>() = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void request_mobile_operations_center()
|
inline void request_mobile_operations_center()
|
||||||
{
|
{
|
||||||
*scr_globals::freemode_global.at(945).as<int*>() = 1;
|
*scr_globals::freemode_global.at(945).as<int*>() = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void request_terrorbyte()
|
inline void request_terrorbyte()
|
||||||
{
|
{
|
||||||
*scr_globals::freemode_global.at(958).as<int*>() = 1;
|
*scr_globals::freemode_global.at(958).as<int*>() = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void request_acidlab()
|
inline void request_acidlab()
|
||||||
{
|
{
|
||||||
*scr_globals::freemode_global.at(959).as<int*>() = 1;
|
*scr_globals::freemode_global.at(959).as<int*>() = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void request_acidlab_bike()
|
inline void request_acidlab_bike()
|
||||||
{
|
{
|
||||||
*scr_globals::freemode_global.at(1009).as<int*>() = 1;
|
*scr_globals::freemode_global.at(1009).as<int*>() = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace mechanic
|
namespace mechanic
|
||||||
{
|
{
|
||||||
inline Vehicle get_personal_vehicle()
|
inline Vehicle get_personal_vehicle()
|
||||||
{
|
{
|
||||||
return *scr_globals::freemode_global.at(301).as<Vehicle*>();
|
return *scr_globals::freemode_global.at(301).as<Vehicle*>();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void summon_vehicle_by_index(int veh_idx)
|
inline CVehicle* get_personal_cvehicle()
|
||||||
{
|
{
|
||||||
if (*scr_globals::freemode_global.at(1000).as<int*>() != -1)
|
Vehicle personal_vehicle = get_personal_vehicle();
|
||||||
return g_notification_service.push_warning("VEHICLE"_T.data(), "VEHICLE_MECHANIC_BUSY"_T.data());
|
if (personal_vehicle != -1 && ENTITY::DOES_ENTITY_EXIST(personal_vehicle))
|
||||||
|
{
|
||||||
if (g.clone_pv.spawn_inside && self::veh)
|
return reinterpret_cast<CVehicle*>(g_pointers->m_gta.m_handle_to_ptr(personal_vehicle));
|
||||||
TASK::CLEAR_PED_TASKS_IMMEDIATELY(PLAYER::PLAYER_PED_ID());
|
}
|
||||||
|
|
||||||
// despawn current veh
|
return nullptr;
|
||||||
util::despawn_current_personal_vehicle();
|
}
|
||||||
mors_mutual::fix_index(veh_idx);
|
|
||||||
|
inline void summon_vehicle_by_index(int veh_idx)
|
||||||
script::get_current()->yield(100ms);
|
{
|
||||||
|
if (*scr_globals::freemode_global.at(1000).as<int*>() != -1)
|
||||||
// only do this when spawn inside is enabled otherwise the vehicle will spawn relatively far away from players
|
return g_notification_service.push_warning("VEHICLE"_T.data(), "VEHICLE_MECHANIC_BUSY"_T.data());
|
||||||
if (g.clone_pv.spawn_inside)
|
|
||||||
{
|
if (g.clone_pv.spawn_inside && self::veh)
|
||||||
*scr_globals::freemode_global.at(957).as<int*>() = 1; // disable vehicle node distance check
|
TASK::CLEAR_PED_TASKS_IMMEDIATELY(PLAYER::PLAYER_PED_ID());
|
||||||
}
|
|
||||||
*scr_globals::freemode_global.at(943).as<int*>() = 1; // tell freemode to spawn our vehicle
|
// despawn current veh
|
||||||
*scr_globals::freemode_global.at(1003).as<int*>() = 0; // required
|
util::despawn_current_personal_vehicle();
|
||||||
*scr_globals::freemode_global.at(1000).as<int*>() = veh_idx;
|
mors_mutual::fix_index(veh_idx);
|
||||||
|
|
||||||
script::get_current()->yield(100ms);
|
script::get_current()->yield(100ms);
|
||||||
|
|
||||||
GtaThread* freemode_thread = gta_util::find_script_thread("freemode"_J);
|
// only do this when spawn inside is enabled otherwise the vehicle will spawn relatively far away from players
|
||||||
if (freemode_thread)
|
if (g.clone_pv.spawn_inside)
|
||||||
{
|
{
|
||||||
// regex to find this shit easily
|
*scr_globals::freemode_global.at(957).as<int*>() = 1; // disable vehicle node distance check
|
||||||
// \(func_\d{3}\(&\(uParam0->f_\d{3}\), \d+000, 0\) \|\| func
|
}
|
||||||
// or if you prefer a string "VD_FAIL4"
|
*scr_globals::freemode_global.at(943).as<int*>() = 1; // tell freemode to spawn our vehicle
|
||||||
// or if you really prefer an image https://i.imgur.com/K8vMILe.png
|
*scr_globals::freemode_global.at(1003).as<int*>() = 0; // required
|
||||||
*scr_locals::freemode::mobile.set(freemode_thread).at(176).as<int*>() = 0; // spawn vehicle instantly
|
*scr_globals::freemode_global.at(1000).as<int*>() = veh_idx;
|
||||||
}
|
|
||||||
|
script::get_current()->yield(100ms);
|
||||||
// blocking call till vehicle is delivered
|
|
||||||
notify::busy_spinner("Delivering vehicle...", scr_globals::freemode_global.at(1000).as<int*>(), -1);
|
GtaThread* freemode_thread = gta_util::find_script_thread("freemode"_J);
|
||||||
|
if (freemode_thread)
|
||||||
if (g.clone_pv.spawn_inside)
|
{
|
||||||
{
|
// regex to find this shit easily
|
||||||
vehicle::bring(get_personal_vehicle(), self::pos, true);
|
// \(func_\d{3}\(&\(uParam0->f_\d{3}\), \d+000, 0\) \|\| func
|
||||||
}
|
// or if you prefer a string "VD_FAIL4"
|
||||||
}
|
// or if you really prefer an image https://i.imgur.com/K8vMILe.png
|
||||||
}
|
*scr_locals::freemode::mobile.set(freemode_thread).at(176).as<int*>() = 0; // spawn vehicle instantly
|
||||||
|
}
|
||||||
namespace mobile_misc
|
|
||||||
{
|
// blocking call till vehicle is delivered
|
||||||
inline void request_taxi()
|
notify::busy_spinner("Delivering vehicle...", scr_globals::freemode_global.at(1000).as<int*>(), -1);
|
||||||
{
|
|
||||||
*scr_globals::freemode_global.at(868).as<int*>() = 1;
|
if (g.clone_pv.spawn_inside)
|
||||||
}
|
{
|
||||||
|
vehicle::bring(get_personal_vehicle(), self::pos, true);
|
||||||
inline void request_gun_van()
|
}
|
||||||
{
|
}
|
||||||
auto local_pos = self::pos;
|
}
|
||||||
auto forward_vector = ENTITY::GET_ENTITY_FORWARD_VECTOR(self::ped);
|
|
||||||
Vector3 spawn_point;
|
namespace mobile_misc
|
||||||
|
{
|
||||||
if (MISC::FIND_SPAWN_POINT_IN_DIRECTION(local_pos.x,
|
inline void request_taxi()
|
||||||
local_pos.y,
|
{
|
||||||
local_pos.z,
|
*scr_globals::freemode_global.at(868).as<int*>() = 1;
|
||||||
forward_vector.x,
|
}
|
||||||
forward_vector.y,
|
|
||||||
forward_vector.z,
|
inline void request_gun_van()
|
||||||
25.f,
|
{
|
||||||
&spawn_point))
|
auto local_pos = self::pos;
|
||||||
{
|
auto forward_vector = ENTITY::GET_ENTITY_FORWARD_VECTOR(self::ped);
|
||||||
*scr_globals::gun_van.as<Vector3*>() = spawn_point;
|
Vector3 spawn_point;
|
||||||
|
|
||||||
return g_notification_service.push_success("GUI_TAB_MOBILE"_T.data(), "REQUEST_GUN_VAN_NOTIFY_SUCCESS"_T.data());
|
if (MISC::FIND_SPAWN_POINT_IN_DIRECTION(local_pos.x,
|
||||||
}
|
local_pos.y,
|
||||||
|
local_pos.z,
|
||||||
g_notification_service.push_warning("GUI_TAB_MOBILE"_T.data(), "REQUEST_GUN_VAN_NOTIFY_FAILED"_T.data());
|
forward_vector.x,
|
||||||
}
|
forward_vector.y,
|
||||||
}
|
forward_vector.z,
|
||||||
}
|
25.f,
|
||||||
|
&spawn_point))
|
||||||
|
{
|
||||||
|
*scr_globals::gun_van.as<Vector3*>() = spawn_point;
|
||||||
|
|
||||||
|
return g_notification_service.push_success("GUI_TAB_MOBILE"_T.data(), "REQUEST_GUN_VAN_NOTIFY_SUCCESS"_T.data());
|
||||||
|
}
|
||||||
|
|
||||||
|
g_notification_service.push_warning("GUI_TAB_MOBILE"_T.data(), "REQUEST_GUN_VAN_NOTIFY_FAILED"_T.data());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user