fivem_latent_callbacks
This script enables you to make “latent” callbacks, using the Native Trigger(Client/Server)LatentEvent to transfer huge data from server → client and opposite. You can use it for Data Transfer or simply for your normal callbacks.
Usage
- Use RegisterCallback(eventName, function(args) … end) to register a callback.
- UnregisterCallback(eventName) to remove a registered callback.
- Use TriggerCallback(eventName, args, timeout, asyncCallback, method) to call a callback.
- eventName: string identifier for the callback.
- args: any Lua table of arguments, with optional key __playerId for server usage.
- timeout: number of seconds (optional). Rejects promise if time exceeded.
- asyncCallback: function (optional). If provided, callback is invoked asynchronously.
- method: ‘normal’ or ‘latent’. ‘latent’ can be used for large data.
- Use TriggerLatentCallback(eventName, args, timeout, asyncCallback) as shorthand for a latent call.
Code is accessible | Yes |
Subscription-based | No |
Lines (approximately) | ~238 |
Requirements & dependencies | NONE |
Support | Yes |