2021-05-20 22:40:13 +02:00
|
|
|
#include "backend/looped/looped.hpp"
|
|
|
|
#include "core/enums.hpp"
|
2022-05-23 06:38:45 +08:00
|
|
|
#include "gta/enums.hpp"
|
2021-05-20 22:40:13 +02:00
|
|
|
#include "util/entity.hpp"
|
|
|
|
|
|
|
|
namespace big
|
|
|
|
{
|
2022-05-23 06:38:45 +08:00
|
|
|
static const int controls[] = {
|
|
|
|
(int)ControllerInputs::INPUT_WEAPON_WHEEL_NEXT,
|
|
|
|
(int)ControllerInputs::INPUT_WEAPON_WHEEL_PREV,
|
|
|
|
(int)ControllerInputs::INPUT_ATTACK
|
|
|
|
};
|
2021-05-20 22:40:13 +02:00
|
|
|
static Entity ent;
|
|
|
|
|
|
|
|
void looped::weapons_steal_vehicle_gun()
|
|
|
|
{
|
2022-05-13 15:33:19 +02:00
|
|
|
if (const bool bStealVehicleGun = g->weapons.custom_weapon == CustomWeapon::STEAL_VEHICLE_GUN; bStealVehicleGun)
|
2021-05-20 22:40:13 +02:00
|
|
|
{
|
2022-05-23 06:38:45 +08:00
|
|
|
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, (int)ControllerInputs::INPUT_AIM))
|
2021-05-20 22:40:13 +02:00
|
|
|
{
|
2022-05-23 06:38:45 +08:00
|
|
|
PLAYER::DISABLE_PLAYER_FIRING(self::id, true);
|
2022-05-13 15:33:19 +02:00
|
|
|
for (const int control : controls)
|
2021-05-20 22:40:13 +02:00
|
|
|
PAD::DISABLE_CONTROL_ACTION(0, control, true);
|
|
|
|
|
2022-05-23 06:38:45 +08:00
|
|
|
if (PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, (int)ControllerInputs::INPUT_ATTACK))
|
2021-05-20 22:40:13 +02:00
|
|
|
{
|
|
|
|
if (entity::raycast(&ent))
|
|
|
|
{
|
|
|
|
if (ENTITY::IS_ENTITY_A_VEHICLE(ent))
|
|
|
|
{
|
2021-05-26 14:26:00 +02:00
|
|
|
for (size_t i = 0; i < 8 && !VEHICLE::IS_VEHICLE_SEAT_FREE(ent, -1, 0); i++)
|
|
|
|
{
|
2022-05-13 15:33:19 +02:00
|
|
|
const auto ped = VEHICLE::GET_PED_IN_VEHICLE_SEAT(ent, -1, 0);
|
2021-05-26 14:26:00 +02:00
|
|
|
TASK::CLEAR_PED_TASKS_IMMEDIATELY(ped);
|
|
|
|
|
2022-05-13 15:33:19 +02:00
|
|
|
script::get_current()->yield(100ms);
|
2021-05-26 14:26:00 +02:00
|
|
|
}
|
2021-05-20 22:40:13 +02:00
|
|
|
|
2022-05-23 06:38:45 +08:00
|
|
|
PED::SET_PED_INTO_VEHICLE(self::ped, ent, -1);
|
2021-05-20 22:40:13 +02:00
|
|
|
}
|
2022-03-02 00:21:29 +01:00
|
|
|
else g_notification_service->push_warning("Weapons", "Entity is not a vehicle.");
|
2021-05-20 22:40:13 +02:00
|
|
|
}
|
2022-03-02 00:21:29 +01:00
|
|
|
else g_notification_service->push_warning("Weapons", "No entity found.");
|
2021-05-20 22:40:13 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|