From c760b6734973efcd46ce96d894b39d9926f7ffc9 Mon Sep 17 00:00:00 2001 From: ElPumpo Date: Sun, 25 Nov 2018 18:42:49 +0100 Subject: [PATCH] Removed useless checks --- client/main.lua | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/client/main.lua b/client/main.lua index b3e58a14..2a5b1952 100644 --- a/client/main.lua +++ b/client/main.lua @@ -433,29 +433,25 @@ function OpenMobileMecanoActionsMenu() elseif data.current.value == 'del_vehicle' then - local ped = PlayerPedId() + local playerPed = PlayerPedId() - if DoesEntityExist(ped) and not IsEntityDead(ped) then - local pos = GetEntityCoords( ped ) + if IsPedSittingInAnyVehicle(playerPed) then + local vehicle = GetVehiclePedIsIn(playerPed, false) - if IsPedSittingInAnyVehicle(ped) then - local vehicle = GetVehiclePedIsIn( ped, false ) - - if GetPedInVehicleSeat(vehicle, -1) == ped then - ESX.ShowNotification(_U('vehicle_impounded')) - ESX.Game.DeleteVehicle(vehicle) - else - ESX.ShowNotification(_U('must_seat_driver')) - end + if GetPedInVehicleSeat(vehicle, -1) == playerPed then + ESX.ShowNotification(_U('vehicle_impounded')) + ESX.Game.DeleteVehicle(vehicle) else - local vehicle = ESX.Game.GetVehicleInDirection() + ESX.ShowNotification(_U('must_seat_driver')) + end + else + local vehicle = ESX.Game.GetVehicleInDirection() - if DoesEntityExist(vehicle) then - ESX.ShowNotification(_U('vehicle_impounded')) - ESX.Game.DeleteVehicle(vehicle) - else - ESX.ShowNotification(_U('must_near')) - end + if DoesEntityExist(vehicle) then + ESX.ShowNotification(_U('vehicle_impounded')) + ESX.Game.DeleteVehicle(vehicle) + else + ESX.ShowNotification(_U('must_near')) end end