Cache
The cache is used to store frequent information that scripts will use, this reduces the load of scripts overall as the core library is the only resource gathering these variables.
Usage
The cache is simple to access, once you've followed the Getting Started steps, you will be able to access the following values:
Update Events
The cache emits update events once a cache value has been updated, this is useful to ensure your script's values are up-to-date.
The event is structured like this
The KEY is the cache value you'd like to watch, in the example below we've used the ped key.
Starting Point
If you'd like a quick list of cache values for your script, use the following snippet.
lib.cache.playerId
This contains the player's local id
lib.cache.serverId
This contains the player's server id or "source"
lib.cache.ped
This contains the player's ped ID
lib.cache.vehicle
This contains the current vehicle the player is within, it returns false if they are not within a vehicle
lib.cache.seat
This contains the current seat the player is in within a vehicle, it returns false if they are not in any vehicle
lib.cache.driver
This contains if the player is the driver of their vehicle
lib.cache.weapon
This contains the model hash of the weapon the player is using, it returns false if they are not holding a weapon
Last updated