citizenfx / fivem

The source code for the Cfx.re modification frameworks, such as FiveM, RedM and LibertyM, as well as FXServer.
https://cfx.re/
3.48k stars 2.06k forks source link

Better documentation for TriggerLatentClientEvent #2644

Open Nexxed opened 1 month ago

Nexxed commented 1 month ago

Segment

Method

Importancy

Missing details

Improvement request

The docs for TriggerLatentClientEvent should be updated to explain the behaviour of the bps parameter when -1 is used for the targetPlayer. It's been uncertain in the past whether the rate is to get the event sent to all clients (so it maintains that rate across all clients) or if that rate is per-player

For example, if there were 10 clients connected to the server, and bps was set to 100, then would that event data be sent at 1000 bytes per second (100 per player) or would it be sent at 100 bytes per second (10 per player). In this example scenario, it would make sense for the latter to be the effect. I can't remember what the actual logic is here, as it's been too long since I touched latent client events.

It would also be nice if some guidelines were given on ideal bps values to avoid issues with big data, and some further documentation on the downsides of using small values since obviously the smaller the rate the longer it'll take for the data to reach all clients (or the server).

And lastly, the docs should better define what "a large amount of data" is so people can better understand when to use the latent event triggers.

https://docs.fivem.net/docs/scripting-manual/working-with-events/triggering-events/#triggering-latent-client-events

Area(s)

FXServer, OneSync, Natives

Additional information

No response

Mathu-lmn commented 1 month ago

Hello, this is not the docs repo, please create a Pull Request on this repository : https://github.com/citizenfx/fivem-docs See this link to know where the specific latent event documentation is located