πŸ‘©β€πŸ”¬CL CACHE

Explanation of Cache Functions

The provided cache functions work exclusively with exports from LGF_Utility. Use these functions to retrieve player and vehicle cache data efficiently.

  • Player Cache: exports.LGF_Utility:cachePed()

  • Vehicle Cache: exports.LGF_Utility:cacheVeh()

These functions ensure that you have access to the most recent and relevant data without manually tracking every change, making your scripts more streamlined and efficient.

Player Cache Variables

| Variable             | Type   | Description                           |
|----------------------|--------|---------------------------------------|
| CachePed.id          | number | The Ped ID of the player              |
| CachePed.serverId    | number | The Server ID of the player           |
| CachePed.ped         | number | The Ped of the player                 |
| CachePed.name        | string | The name of the player (Steam)        |
| CachePed.identifier  | string | The identifier of the player (Core)   |
| CachePed.job         | string | The Job of the player (core)          |
| CachePed.group       | string | The Player Group (Core)               |
| CachePed.coords      | number | The vec3 coords                       |

Vehicle Cache Variables

Cache Exports

Cache Example

Retrieve Personal Cache

Retrieve Vehicle Cache

Implementing in a Command

Implementing Command to Retrieve and Clear Player Cache

The LGF.Command:CreateCommand function provides two custom commands to retrieve and clear player cache data.

  1. Retrieve Player Cache Data

    Command Name: cache

  2. Functionality: This command retrieves the player cache data for a specific player ID. When triggered, it awaits a callback to get the cached data from LGF_Utility. If the data is found, it uses a built-in utility function to print the player cache information. If not, it prints a warning message.

  3. Clea Player Cache Data

    Command Name: clearchache

  4. Functionality: This feature gets the player's cache and clears it when needed

Last updated