Emit Server
A module to optimize your trigger events server <> client.
Configuration Variables (Convars)
| Convar | Side | Type | Default | Description |
|---|---|---|---|---|
jo_libs:emit:bps | Server | Integer | 20000 | Default bit/s for latent events |
JO Functions
jo.emit.triggerClient()
A function to trigger a client(s)
Syntax
lua
jo.emit.triggerClient(eventName, source, ...)Parameters
eventName : string
The event name
source : integer|table
The player ID or list of players ID
... : any
Other arguments
Example
lua
local source = 5
local data = "MyData"
jo.emit.triggerClient('YourEventName', source, data)
--OR--
local sources = { 3, 4, 5, 13 } --list of players
local data = "MyData"
jo.emit.triggerClient('YourEventName', sources, data)jo.emit.triggerClient.latent()
A function to trigger a client(s) with a limited bandwith
Syntax
lua
jo.emit.triggerClient.latent(eventName, source, ...)Parameters
eventName : string
The event name
source : integer|table
The player ID or list of players ID
... : any
Other arguments
Example
lua
local source = 5
local data = {}
for i = 1, 100000 do
data[i] = i
end
jo.emit.triggerClient.latent('YourEventName', source, data)
--OR--
local sources = { 3, 4, 5, 13 } --list of players
local data = {}
for i = 1, 100000 do
data[i] = i
end
jo.emit.triggerClient.latent('YourEventName', sources, data)jo.emit.triggerServerWithSource()
Trigger an event on the server side and keep the source injection
Syntax
lua
jo.emit.triggerServerWithSource(source, event, ...)Parameters
source : integer
The source player ID to send the event to
event : string
The name of the event to trigger
... : any
Additional parameters to pass to the event
jo.emit.updateBps()
A function to update the bit/s of emit module
Syntax
lua
jo.emit.updateBps(bps)Parameters
bps : integer
bit/s
Example
lua
jo.emit.updateBps(3000)