feat(StealVehicleGun): Added timeout between kicking out of vehicle

This commit is contained in:
Yimura 2022-05-13 15:33:19 +02:00
parent 49e6739c0f
commit 3c1aaec970

View File

@ -9,16 +9,14 @@ namespace big
void looped::weapons_steal_vehicle_gun() void looped::weapons_steal_vehicle_gun()
{ {
bool bStealVehicleGun = g->weapons.custom_weapon == CustomWeapon::STEAL_VEHICLE_GUN; if (const bool bStealVehicleGun = g->weapons.custom_weapon == CustomWeapon::STEAL_VEHICLE_GUN; bStealVehicleGun)
if (bStealVehicleGun)
{ {
Ped player = PLAYER::PLAYER_PED_ID(); Ped player = PLAYER::PLAYER_PED_ID();
if (PAD::IS_DISABLED_CONTROL_PRESSED(0, 25)) if (PAD::IS_DISABLED_CONTROL_PRESSED(0, 25))
{ {
PLAYER::DISABLE_PLAYER_FIRING(PLAYER::GET_PLAYER_INDEX(), true); PLAYER::DISABLE_PLAYER_FIRING(PLAYER::GET_PLAYER_INDEX(), true);
for (int control : controls) for (const int control : controls)
PAD::DISABLE_CONTROL_ACTION(0, control, true); PAD::DISABLE_CONTROL_ACTION(0, control, true);
if (PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, 24)) if (PAD::IS_DISABLED_CONTROL_JUST_RELEASED(0, 24))
@ -29,10 +27,10 @@ namespace big
{ {
for (size_t i = 0; i < 8 && !VEHICLE::IS_VEHICLE_SEAT_FREE(ent, -1, 0); i++) for (size_t i = 0; i < 8 && !VEHICLE::IS_VEHICLE_SEAT_FREE(ent, -1, 0); i++)
{ {
Ped ped = VEHICLE::GET_PED_IN_VEHICLE_SEAT(ent, -1, 0); const auto ped = VEHICLE::GET_PED_IN_VEHICLE_SEAT(ent, -1, 0);
TASK::CLEAR_PED_TASKS_IMMEDIATELY(ped); TASK::CLEAR_PED_TASKS_IMMEDIATELY(ped);
script::get_current()->yield(); script::get_current()->yield(100ms);
} }
PED::SET_PED_INTO_VEHICLE(PLAYER::PLAYER_PED_ID(), ent, -1); PED::SET_PED_INTO_VEHICLE(PLAYER::PLAYER_PED_ID(), ent, -1);