mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 23:46:03 +01:00
fix(cache): update seat when shuffling
This commit is contained in:
10
resource/cache/client.lua
vendored
10
resource/cache/client.lua
vendored
@@ -1,12 +1,13 @@
|
|||||||
local cache = {}
|
local cache = {}
|
||||||
|
|
||||||
|
local GetPedInVehicleSeat = GetPedInVehicleSeat
|
||||||
function cache:getVehicle()
|
function cache:getVehicle()
|
||||||
local vehicle = GetVehiclePedIsIn(self.ped, false)
|
local vehicle = GetVehiclePedIsIn(self.ped, false)
|
||||||
if vehicle > 0 then
|
if vehicle > 0 then
|
||||||
if self:set('vehicle', vehicle) then
|
self:set('vehicle', vehicle)
|
||||||
local seats = GetVehicleMaxNumberOfPassengers(vehicle) - 1
|
|
||||||
local GetPedInVehicleSeat = GetPedInVehicleSeat
|
if not cache.seat or GetPedInVehicleSeat(vehicle, cache.seat) ~= cache.ped then
|
||||||
for i = -1, seats do
|
for i = -1, GetVehicleMaxNumberOfPassengers(vehicle) - 1 do
|
||||||
if GetPedInVehicleSeat(vehicle, i) == self.ped then
|
if GetPedInVehicleSeat(vehicle, i) == self.ped then
|
||||||
return self:set('seat', i)
|
return self:set('seat', i)
|
||||||
end
|
end
|
||||||
@@ -47,6 +48,7 @@ CreateThread(function()
|
|||||||
while true do
|
while true do
|
||||||
num += 1
|
num += 1
|
||||||
cache:set('ped', PlayerPedId())
|
cache:set('ped', PlayerPedId())
|
||||||
|
print(cache.seat)
|
||||||
|
|
||||||
if num > 1 then
|
if num > 1 then
|
||||||
cache.coords = GetEntityCoords(cache.ped)
|
cache.coords = GetEntityCoords(cache.ped)
|
||||||
|
|||||||
Reference in New Issue
Block a user