2021-05-20 22:40:13 +02:00
|
|
|
#include "backend/looped/looped.hpp"
|
|
|
|
#include "core/enums.hpp"
|
|
|
|
#include "util/entity.hpp"
|
|
|
|
|
|
|
|
namespace big
|
|
|
|
{
|
|
|
|
static const int controls[] = { 14, 15, 24 };
|
|
|
|
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
|
|
|
{
|
|
|
|
Ped player = PLAYER::PLAYER_PED_ID();
|
|
|
|
|
|
|
|
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, 25))
|
|
|
|
{
|
2021-11-11 01:14:22 +01:00
|
|
|
PLAYER::DISABLE_PLAYER_FIRING(PLAYER::GET_PLAYER_INDEX(), 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);
|
|
|
|
|
|
|
|
if (PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, 24))
|
|
|
|
{
|
|
|
|
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
|
|
|
|
|
|
|
PED::SET_PED_INTO_VEHICLE(PLAYER::PLAYER_PED_ID(), ent, -1);
|
|
|
|
}
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|