Skip to content

Commit

Permalink
Merge pull request #1399 from Arctos2win/dev
Browse files Browse the repository at this point in the history
fix(client/modules/actions.lua): check if vehicle changed
  • Loading branch information
Gellipapa authored Sep 16, 2024
2 parents 5fb49df + 4d608de commit c3052cb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions [core]/es_extended/client/modules/actions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand All @@ -80,16 +81,16 @@ 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)
TriggerEvent("esx:enteredVehicle", current.vehicle, current.plate, current.seat, current.displayName, current.netId)
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)
Expand Down

0 comments on commit c3052cb

Please sign in to comment.