diff --git a/[core]/es_extended/client/modules/actions.lua b/[core]/es_extended/client/modules/actions.lua index 401297d8..ce6f1466 100644 --- a/[core]/es_extended/client/modules/actions.lua +++ b/[core]/es_extended/client/modules/actions.lua @@ -59,6 +59,7 @@ CreateThread(function() TriggerEvent("esx:pauseMenuActive", inPauseMenu) end + local tempVehicle = GetVehiclePedIsUsing(playerPed) if not isInVehicle and not IsPlayerDead(PlayerId()) then if DoesEntityExist(GetVehiclePedIsTryingToEnter(playerPed)) and not isEnteringVehicle then -- trying to enter a vehicle! @@ -80,7 +81,7 @@ CreateThread(function() -- suddenly appeared in a vehicle, possible teleport isEnteringVehicle = false isInVehicle = true - current.vehicle = GetVehiclePedIsUsing(playerPed) + current.vehicle = tempVehicle current.seat = GetPedVehicleSeat(playerPed, current.vehicle) current.plate = GetVehicleNumberPlateText(current.vehicle) current.displayName, current.netId = GetData(current.vehicle) @@ -88,8 +89,8 @@ CreateThread(function() TriggerServerEvent("esx:enteredVehicle", current.plate, current.seat, current.displayName, current.netId) ToggleVehicleStatus(current.vehicle, current.seat) end - elseif isInVehicle then - if not IsPedInAnyVehicle(playerPed, false) or IsPlayerDead(PlayerId()) then + elseif isInVehicle or (current.vehicle ~= tempVehicle) then + if not IsPedInAnyVehicle(playerPed, false) or IsPlayerDead(PlayerId()) or (current.vehicle ~= tempVehicle) then -- bye, vehicle TriggerEvent("esx:exitedVehicle", current.vehicle, current.plate, current.seat, current.displayName, current.netId) TriggerServerEvent("esx:exitedVehicle", current.plate, current.seat, current.displayName, current.netId)