diff --git a/[core]/es_extended/client/modules/actions.lua b/[core]/es_extended/client/modules/actions.lua index 16c75c80e..89c6757c6 100644 --- a/[core]/es_extended/client/modules/actions.lua +++ b/[core]/es_extended/client/modules/actions.lua @@ -130,6 +130,20 @@ function Actions:TrackVehicle() end elseif self.inVehicle then self:ExitVehicle() + self:TrackSeat() + end +end + +function Actions:TrackSeat() + if not self.inVehicle then + return + end + + local newSeat = self:GetSeatPedIsIn() + if newSeat ~= self.seat then + self.seat = newSeat + ESX.SetPlayerData("seat", self.seat) + TriggerEvent("esx:vehicleSeatChanged", self.seat) end end @@ -140,6 +154,7 @@ function Actions:TrackWeapon() if newWeapon ~= self.currentWeapon then self.currentWeapon = newWeapon + ESX.SetPlayerData("weapon", self.currentWeapon) TriggerEvent("esx:weaponChanged", self.currentWeapon) end end