2022-01-14 16:12:30 +01:00
|
|
|
#include "backend/looped/looped.hpp"
|
|
|
|
#include "gta_util.hpp"
|
|
|
|
#include "script_local.hpp"
|
|
|
|
#include "util/math.hpp"
|
|
|
|
#include "util/scripts.hpp"
|
|
|
|
|
|
|
|
namespace big
|
|
|
|
{
|
|
|
|
static bool state = false;
|
2023-03-01 21:27:15 +00:00
|
|
|
static bool busy = false;
|
2022-01-14 16:12:30 +01:00
|
|
|
|
2023-03-01 21:27:15 +00:00
|
|
|
constexpr auto CARMOD_SHOP_STRUCT = 730; // move_m@generic_idles@std -- one function below -- first local
|
|
|
|
constexpr auto CARMOD_SHOP_CUTSCENE = 2208;// "carmod_fam1" -- first boolean local below it
|
2022-11-14 14:10:41 +01:00
|
|
|
|
2022-01-14 16:12:30 +01:00
|
|
|
void looped::vehicle_ls_customs()
|
|
|
|
{
|
2023-03-01 21:27:15 +00:00
|
|
|
if (busy)
|
|
|
|
return;
|
2022-01-14 16:12:30 +01:00
|
|
|
busy = true;
|
|
|
|
|
|
|
|
constexpr int hash = RAGE_JOAAT("carmod_shop");
|
2022-12-18 23:15:52 +01:00
|
|
|
if (g.vehicle.ls_customs && g.vehicle.ls_customs == state)
|
2022-01-14 16:12:30 +01:00
|
|
|
{
|
2023-03-01 21:27:15 +00:00
|
|
|
if (auto carmod_shop_thread = gta_util::find_script_thread(hash);
|
|
|
|
carmod_shop_thread && *script_local(carmod_shop_thread, CARMOD_SHOP_STRUCT).at(11).as<int*>() != 4)
|
2022-01-14 16:12:30 +01:00
|
|
|
{
|
2022-12-18 23:15:52 +01:00
|
|
|
g.vehicle.ls_customs = false;
|
2022-01-14 16:12:30 +01:00
|
|
|
|
2023-03-01 21:27:15 +00:00
|
|
|
*script_local(carmod_shop_thread, CARMOD_SHOP_STRUCT).as<int*>() = 1;// cleanup
|
2022-01-14 16:12:30 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-12-18 23:15:52 +01:00
|
|
|
if (g.vehicle.ls_customs && g.vehicle.ls_customs != state)
|
2022-01-14 16:12:30 +01:00
|
|
|
{
|
2022-05-23 06:38:45 +08:00
|
|
|
Vehicle veh = self::veh;
|
2022-01-14 16:12:30 +01:00
|
|
|
if (!ENTITY::DOES_ENTITY_EXIST(veh) || ENTITY::IS_ENTITY_DEAD(veh, false))
|
|
|
|
{
|
2023-03-01 21:27:15 +00:00
|
|
|
busy = false;
|
2022-12-18 23:15:52 +01:00
|
|
|
g.vehicle.ls_customs = false;
|
2022-01-14 16:12:30 +01:00
|
|
|
|
2022-03-02 00:21:29 +01:00
|
|
|
g_notification_service->push_warning("LS Customs", "You aren't in a vehicle.");
|
2022-01-14 16:12:30 +01:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
scripts::request_script(hash);
|
|
|
|
if (scripts::wait_till_loaded(hash))
|
|
|
|
{
|
2023-03-01 21:27:15 +00:00
|
|
|
int args[] = {45, 0, 9};
|
2022-01-14 16:12:30 +01:00
|
|
|
scripts::start_script_with_args(hash, args, 3, 3600);
|
|
|
|
|
|
|
|
scripts::wait_till_running(hash);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (scripts::is_running(hash))
|
|
|
|
{
|
|
|
|
if (auto carmod_shop_thread = gta_util::find_script_thread(hash); carmod_shop_thread)
|
|
|
|
{
|
2023-03-01 21:27:15 +00:00
|
|
|
*script_local(carmod_shop_thread, CARMOD_SHOP_STRUCT).at(409).as<int*>() = veh;// "HIDDEN_RADIO_09_HIPHOP_OLD"
|
|
|
|
*script_local(carmod_shop_thread, CARMOD_SHOP_CUTSCENE).as<bool*>() = false;// skips cutscene that's invisible
|
2022-01-14 16:12:30 +01:00
|
|
|
|
2022-11-14 14:10:41 +01:00
|
|
|
*script_local(carmod_shop_thread, CARMOD_SHOP_STRUCT).at(11).as<int*>() = 4;
|
2022-01-14 16:12:30 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-03-01 21:27:15 +00:00
|
|
|
busy = false;
|
2022-12-18 23:15:52 +01:00
|
|
|
state = g.vehicle.ls_customs;
|
2022-01-14 16:12:30 +01:00
|
|
|
}
|
|
|
|
}
|