Update cache information

This commit is contained in:
Linden committed 2022-03-02 01:05:56 +11:00
1 parent fd5ccc4964
commit 9c3b63edc2
2 files changed
+17 -6

No files matched your search

+16 -5
View File
@@ -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)
```
+1 -1
View File
@@ -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