From 9c3b63edc25c56a781cd19ce4f2f6bd2d0ab2f58 Mon Sep 17 00:00:00 2001 From: Linden <65407488+thelindat@users.noreply.github.com> Date: Wed, 2 Mar 2022 01:05:56 +1100 Subject: [PATCH] Update cache information --- docs/ox_lib/Client/cache.md | 21 ++++++++++++++++----- docs/ox_lib/Client/streaming.md | 2 +- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/docs/ox_lib/Client/cache.md b/docs/ox_lib/Client/cache.md index 078c7556..a6929cce 100644 --- a/docs/ox_lib/Client/cache.md +++ b/docs/ox_lib/Client/cache.md @@ -3,12 +3,23 @@ Caches data related to the player and handling some events or statebags. An interval runs every 100ms to update data that cannot be checked via handlers. -Still a work-in-progress and does not have any API or events. -https://github.com/overextended/ox_lib/blob/master/resource/states/client.lua +https://github.com/overextended/ox_lib/blob/master/resource/cache/client.lua ## States ```lua -cache.ped = PlayerPedId() -cache.vehicle = GetVehiclePedIsIn(cache.ped, false) -cache.driver = GetPedInVehicleSeat(cache.vehicle, -1) == cache.ped +cache.ped -- player entity id +cache.vehicle -- vehicle entity id +cache.seat -- vehicle seat index +``` + +## lib.onCache +Register a callback function when the value is changed. +```lua +lib.onCache('vehicle', function(value) + print('vehicle', value) +end) + +lib.onCache('seat', function(value) + print('seat', value) +end) ``` diff --git a/docs/ox_lib/Client/streaming.md b/docs/ox_lib/Client/streaming.md index cb877b64..07b6d952 100644 --- a/docs/ox_lib/Client/streaming.md +++ b/docs/ox_lib/Client/streaming.md @@ -1,7 +1,7 @@ # Streaming Check if assets exist, such as models, and loads them into memory. -Throws errors for invalid assets and returns false if it could not be loaded. +Throws errors for invalid assets and returns true if the asset is loaded. ### lib.requestAnimDict ```lua