- Documentation
- Server functions
- triggerLatentClientEvent
Function
triggerLatentClientEvent
Sends an event to clients like triggerClientEvent, intended for large data sent in the background (with a bandwidth limit). Argument order: sendTo, name, [bandwidth], [persist], sourceElement, .... Progress can be checked with getLatentEventHandles and getLatentEventStatus.
Syntax
bool triggerLatentClientEvent(string name, element theElement [, element/table sendTo = root, int bandwidth, bool persist = false, any ...])Arguments
sendToelement/table, optional = root- A player, a table of players or
root. namestring- Event name.
bandwidthint, optional- Bytes per second limit (compatibility with existing scripts).
persistbool, optional = false- For compatibility with existing scripts.
theElementelement- The source element.
...any, optional- Event arguments.
Returns
true on success.
Example
addEventHandler("onPlayerLogin", root, function()
local data = {}
for i = 1, 1000 do data[i] = { id = i, name = "Przedmiot " .. i } end
triggerLatentClientEvent(source, "onShopData", 50000, false, resourceRoot, data)
end)
Notes
The bandwidth limit is ignored: data goes through the normal event channel, which splits large packets anyway.