mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 23:46:03 +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
|
end
|
||||||
|
|
||||||
CreateThread(function()
|
CreateThread(function()
|
||||||
|
local num = 1
|
||||||
while true do
|
while true do
|
||||||
|
num += 1
|
||||||
cache:set('ped', PlayerPedId())
|
cache:set('ped', PlayerPedId())
|
||||||
cache:getVehicle()
|
|
||||||
|
|
||||||
-- if not cache.vehicle then
|
if num > 1 then
|
||||||
-- cache:onFoot()
|
cache.coords = GetEntityCoords(cache.ped)
|
||||||
-- else
|
cache:getVehicle()
|
||||||
-- cache:inVehicle()
|
-- if not cache.vehicle then
|
||||||
-- end
|
-- cache:onFoot()
|
||||||
|
-- else
|
||||||
|
-- cache:inVehicle()
|
||||||
|
-- end
|
||||||
|
num = 0
|
||||||
|
end
|
||||||
|
|
||||||
if next(update) then
|
if next(update) then
|
||||||
TriggerEvent('ox_lib:updateCache', update)
|
TriggerEvent('ox_lib:updateCache', update)
|
||||||
@@ -64,4 +70,6 @@ end)
|
|||||||
|
|
||||||
function lib.cache(key)
|
function lib.cache(key)
|
||||||
return cache[key]
|
return cache[key]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
_ENV.cache = cache
|
||||||
|
|||||||
Reference in New Issue
Block a user