2022-01-07 13:58:51 +01:00
|
|
|
#pragma once
|
|
|
|
#include "core/enums.hpp"
|
2022-11-21 15:42:12 +00:00
|
|
|
#include "core/scr_globals.hpp"
|
2022-01-18 02:06:28 +01:00
|
|
|
#include "globals.hpp"
|
2022-01-08 05:42:36 +01:00
|
|
|
#include "gta_util.hpp"
|
2022-01-07 13:58:51 +01:00
|
|
|
#include "misc.hpp"
|
2022-01-07 15:05:47 +01:00
|
|
|
#include "natives.hpp"
|
2022-01-18 02:06:28 +01:00
|
|
|
#include "notify.hpp"
|
2022-01-08 05:42:36 +01:00
|
|
|
#include "script.hpp"
|
2023-08-24 16:06:50 -04:00
|
|
|
#include "core/scr_globals.hpp"
|
2022-01-08 05:42:36 +01:00
|
|
|
#include "script_local.hpp"
|
2022-01-18 02:06:28 +01:00
|
|
|
#include "vehicle.hpp"
|
2022-01-07 13:58:51 +01:00
|
|
|
|
|
|
|
namespace big::mobile
|
|
|
|
{
|
2022-01-08 05:42:36 +01:00
|
|
|
namespace util
|
|
|
|
{
|
2023-07-03 14:20:27 +02:00
|
|
|
int get_current_personal_vehicle(); // forward declare
|
2022-01-08 05:42:36 +01:00
|
|
|
inline void despawn_current_personal_vehicle()
|
|
|
|
{
|
2023-03-01 21:27:15 +00:00
|
|
|
misc::clear_bits(scr_globals::vehicle_global.at(get_current_personal_vehicle(), 142).at(103).as<int*>(), eVehicleFlags::TRIGGER_SPAWN_TOGGLE);
|
2022-01-08 05:42:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
inline int get_current_personal_vehicle()
|
|
|
|
{
|
2023-08-24 16:06:50 -04:00
|
|
|
return *scr_globals::stats.at(0, 5568).at(681).at(2).as<int*>();
|
2022-01-08 05:42:36 +01:00
|
|
|
}
|
|
|
|
}
|
2023-01-06 23:25:16 +00:00
|
|
|
|
2022-11-17 17:05:47 +00:00
|
|
|
namespace merry_weather
|
|
|
|
{
|
|
|
|
inline void request_ammo_drop()
|
|
|
|
{
|
2023-08-24 16:06:50 -04:00
|
|
|
*scr_globals::freemode_global.at(891).as<int*>() = 1;
|
2022-11-17 17:05:47 +00:00
|
|
|
}
|
2023-01-06 23:25:16 +00:00
|
|
|
|
2023-02-04 23:49:44 +01:00
|
|
|
inline void request_boat_pickup()
|
|
|
|
{
|
2023-08-24 16:06:50 -04:00
|
|
|
*scr_globals::freemode_global.at(892).as<int*>() = 1;
|
2023-02-04 23:49:44 +01:00
|
|
|
}
|
|
|
|
|
2022-11-17 17:05:47 +00:00
|
|
|
inline void request_helicopter_pickup()
|
|
|
|
{
|
2023-08-24 16:06:50 -04:00
|
|
|
*scr_globals::freemode_global.at(893).as<int*>() = 1;
|
2022-11-17 17:05:47 +00:00
|
|
|
}
|
2022-12-30 02:09:33 +01:00
|
|
|
|
|
|
|
inline void request_backup_helicopter()
|
|
|
|
{
|
2023-08-24 16:06:50 -04:00
|
|
|
*scr_globals::freemode_global.at(4491).as<int*>() = 1;
|
2022-12-30 02:09:33 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void request_airstrike()
|
|
|
|
{
|
2023-08-24 16:06:50 -04:00
|
|
|
*scr_globals::freemode_global.at(4492).as<int*>() = 1;
|
2022-12-30 02:09:33 +01:00
|
|
|
}
|
2022-11-17 17:05:47 +00:00
|
|
|
}
|
2022-01-07 13:58:51 +01:00
|
|
|
|
2022-01-08 05:42:36 +01:00
|
|
|
namespace mors_mutual
|
|
|
|
{
|
2022-01-10 12:54:05 +01:00
|
|
|
inline bool fix_index(int veh_idx, bool spawn_veh = false)
|
|
|
|
{
|
2023-03-01 21:27:15 +00:00
|
|
|
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);
|
2022-01-10 12:54:05 +01:00
|
|
|
|
|
|
|
if (can_be_fixed)
|
|
|
|
{
|
2023-03-01 21:27:15 +00:00
|
|
|
misc::clear_bits(scr_globals::vehicle_global.at(veh_idx, 142).at(103).as<int*>(), eVehicleFlags::DESTROYED | eVehicleFlags::IMPOUNDED | eVehicleFlags::UNK2);
|
2022-01-10 12:54:05 +01:00
|
|
|
|
|
|
|
if (spawn_veh)
|
|
|
|
{
|
2023-03-01 21:27:15 +00:00
|
|
|
misc::set_bits(scr_globals::vehicle_global.at(veh_idx, 142).at(103).as<int*>(), eVehicleFlags::TRIGGER_SPAWN_TOGGLE | eVehicleFlags::SPAWN_AT_MORS_MUTUAL);
|
2022-01-10 12:54:05 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return can_be_fixed;
|
|
|
|
}
|
|
|
|
|
|
|
|
inline int fix_all()
|
|
|
|
{
|
|
|
|
int fixed_count = 0;
|
|
|
|
|
2022-11-21 15:42:12 +00:00
|
|
|
const int arr_size = *scr_globals::vehicle_global.as<int*>();
|
2022-01-10 12:54:05 +01:00
|
|
|
for (int i = 0; i < arr_size; i++)
|
2022-02-01 22:04:56 +01:00
|
|
|
if (fix_index(i, true))
|
2022-01-10 12:54:05 +01:00
|
|
|
fixed_count++;
|
|
|
|
|
|
|
|
return fixed_count;
|
|
|
|
}
|
2022-01-08 05:42:36 +01:00
|
|
|
}
|
2022-01-10 12:54:05 +01:00
|
|
|
|
2022-12-30 02:09:33 +01:00
|
|
|
namespace ceo_abilities
|
|
|
|
{
|
|
|
|
inline void request_bullshark_testosterone()
|
|
|
|
{
|
2023-08-24 16:06:50 -04:00
|
|
|
*scr_globals::freemode_properties.at(3690).as<int*>() = 1;
|
2022-12-30 02:09:33 +01:00
|
|
|
}
|
2023-03-01 21:27:15 +00:00
|
|
|
|
2023-07-03 14:20:27 +02:00
|
|
|
inline void request_ballistic_armor() //i think this is a ceo ability atleast?
|
2023-02-04 23:49:44 +01:00
|
|
|
{
|
2023-08-24 16:06:50 -04:00
|
|
|
*scr_globals::freemode_global.at(896).as<int*>() = 1;
|
2023-02-04 23:49:44 +01:00
|
|
|
}
|
2022-12-30 02:09:33 +01:00
|
|
|
}
|
|
|
|
|
2023-07-14 18:57:30 -04:00
|
|
|
namespace services
|
|
|
|
{
|
|
|
|
inline void request_avenger()
|
|
|
|
{
|
2023-08-24 16:06:50 -04:00
|
|
|
*scr_globals::freemode_global.at(938).as<int*>() = 1;
|
2023-07-14 18:57:30 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void request_kosatka()
|
|
|
|
{
|
2023-08-24 16:06:50 -04:00
|
|
|
*scr_globals::freemode_global.at(960).as<int*>() = 1;
|
2023-07-14 18:57:30 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void request_mobile_operations_center()
|
|
|
|
{
|
2023-08-24 16:06:50 -04:00
|
|
|
*scr_globals::freemode_global.at(930).as<int*>() = 1;
|
2023-07-14 18:57:30 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void request_terrorbyte()
|
|
|
|
{
|
2023-08-24 16:06:50 -04:00
|
|
|
*scr_globals::freemode_global.at(943).as<int*>() = 1;
|
2023-07-14 18:57:30 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void request_acidlab()
|
|
|
|
{
|
2023-08-24 16:06:50 -04:00
|
|
|
*scr_globals::freemode_global.at(944).as<int*>() = 1;
|
2023-07-14 18:57:30 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
inline void request_acidlab_bike()
|
|
|
|
{
|
2023-08-24 16:06:50 -04:00
|
|
|
*scr_globals::freemode_global.at(994).as<int*>() = 1;
|
2023-07-14 18:57:30 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-07 15:05:47 +01:00
|
|
|
namespace mechanic
|
|
|
|
{
|
2022-07-27 14:39:22 +02:00
|
|
|
inline Vehicle get_personal_vehicle()
|
|
|
|
{
|
2023-08-24 16:06:50 -04:00
|
|
|
return *scr_globals::freemode_global.at(299).as<Vehicle*>();
|
2022-07-27 14:39:22 +02:00
|
|
|
}
|
|
|
|
|
2022-01-08 05:42:36 +01:00
|
|
|
inline void summon_vehicle_by_index(int veh_idx)
|
|
|
|
{
|
2023-08-24 16:06:50 -04:00
|
|
|
if (*scr_globals::freemode_global.at(985).as<int*>() != -1)
|
2022-03-02 00:21:29 +01:00
|
|
|
return g_notification_service->push_warning("Vehicle", "Mechanic is not ready to deliver a vehicle right now.");
|
2022-01-18 02:06:28 +01:00
|
|
|
|
2022-12-18 23:15:52 +01:00
|
|
|
if (g.clone_pv.spawn_inside && self::veh)
|
2022-05-23 06:38:45 +08:00
|
|
|
TASK::CLEAR_PED_TASKS_IMMEDIATELY(PLAYER::PLAYER_PED_ID());
|
2022-01-22 00:06:43 +01:00
|
|
|
|
2022-01-08 05:42:36 +01:00
|
|
|
// despawn current veh
|
|
|
|
util::despawn_current_personal_vehicle();
|
|
|
|
mors_mutual::fix_index(veh_idx);
|
2022-01-07 15:05:47 +01:00
|
|
|
|
2022-01-08 05:42:36 +01:00
|
|
|
script::get_current()->yield(100ms);
|
|
|
|
|
2023-02-12 00:47:05 +01:00
|
|
|
// only do this when spawn inside is enabled otherwise the vehicle will spawn relatively far away from players
|
|
|
|
if (g.clone_pv.spawn_inside)
|
|
|
|
{
|
2023-08-24 16:06:50 -04:00
|
|
|
*scr_globals::freemode_global.at(942).as<int*>() = 1; // disable vehicle node distance check
|
2023-02-12 00:47:05 +01:00
|
|
|
}
|
2023-08-24 16:06:50 -04:00
|
|
|
*scr_globals::freemode_global.at(928).as<int*>() = 1; // tell freemode to spawn our vehicle
|
|
|
|
*scr_globals::freemode_global.at(988).as<int*>() = 0; // required
|
|
|
|
*scr_globals::freemode_global.at(985).as<int*>() = veh_idx;
|
2022-01-08 05:42:36 +01:00
|
|
|
|
|
|
|
script::get_current()->yield(100ms);
|
|
|
|
|
|
|
|
GtaThread* freemode_thread = gta_util::find_script_thread(RAGE_JOAAT("freemode"));
|
|
|
|
if (freemode_thread)
|
2023-07-11 23:53:15 +02:00
|
|
|
{
|
|
|
|
// regex to find this shit easily
|
|
|
|
// \(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::fm_mobile::mobile.set(freemode_thread).at(176).as<int*>() = 0; // spawn vehicle instantly
|
|
|
|
}
|
2022-01-18 02:06:28 +01:00
|
|
|
|
|
|
|
// blocking call till vehicle is delivered
|
2023-08-24 16:06:50 -04:00
|
|
|
notify::busy_spinner("Delivering vehicle...", scr_globals::freemode_global.at(985).as<int*>(), -1);
|
2022-01-18 02:06:28 +01:00
|
|
|
|
2022-12-18 23:15:52 +01:00
|
|
|
if (g.clone_pv.spawn_inside)
|
2022-07-10 06:33:14 +08:00
|
|
|
{
|
2023-07-11 23:53:15 +02:00
|
|
|
vehicle::bring(get_personal_vehicle(), self::pos, true);
|
2022-07-10 06:33:14 +08:00
|
|
|
}
|
2022-01-08 05:42:36 +01:00
|
|
|
}
|
2022-01-07 15:05:47 +01:00
|
|
|
}
|
2023-07-14 18:57:30 -04:00
|
|
|
|
|
|
|
namespace mobile_misc
|
|
|
|
{
|
|
|
|
inline void request_taxi()
|
|
|
|
{
|
2023-08-24 16:06:50 -04:00
|
|
|
*scr_globals::freemode_global.at(853).as<int*>() = 1;
|
2023-07-14 18:57:30 -04:00
|
|
|
}
|
|
|
|
}
|
2023-06-15 18:22:41 +08:00
|
|
|
}
|