mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 15:06:02 +01:00
perf(cache): check vehicle every second tick
This commit is contained in:
22
resource/cache/client.lua
vendored
22
resource/cache/client.lua
vendored
@@ -43,15 +43,21 @@ function cache:set(key, value)
|
||||
end
|
||||
|
||||
CreateThread(function()
|
||||
local num = 1
|
||||
while true do
|
||||
num += 1
|
||||
cache:set('ped', PlayerPedId())
|
||||
cache:getVehicle()
|
||||
|
||||
-- if not cache.vehicle then
|
||||
-- cache:onFoot()
|
||||
-- else
|
||||
-- cache:inVehicle()
|
||||
-- end
|
||||
if num > 1 then
|
||||
cache.coords = GetEntityCoords(cache.ped)
|
||||
cache:getVehicle()
|
||||
-- if not cache.vehicle then
|
||||
-- cache:onFoot()
|
||||
-- else
|
||||
-- cache:inVehicle()
|
||||
-- end
|
||||
num = 0
|
||||
end
|
||||
|
||||
if next(update) then
|
||||
TriggerEvent('ox_lib:updateCache', update)
|
||||
@@ -64,4 +70,6 @@ end)
|
||||
|
||||
function lib.cache(key)
|
||||
return cache[key]
|
||||
end
|
||||
end
|
||||
|
||||
_ENV.cache = cache
|
||||
|
||||
Reference in New Issue
Block a user