Net events, checked
RLX.RegisterNetEvent replaces lsmp.onClient when a client event can change something. It does the checks everyone forgets.
lua
-- Server
RLX.RegisterNetEvent("myshop:buy", { rate = 5, job = "police", onDuty = true }, function(source, item)
local xPlayer = RLX.GetPlayer(source)
...
end)lua
-- Client
RLX.TriggerServerEvent("myshop:buy", "bread")| Option | Default | Effect |
|---|---|---|
rate | 10 | Calls per second per player; the rest is dropped, and logged once. |
loaded | true | A character must be in game. |
permission | — | An LS:MP permission. |
job / gang | — | A name or a list of names. |
onDuty | — | With job: on duty only. |
minGrade | — | The minimum grade. |
The handler runs in a thread (it may wait for the database), and an error does not stop the others. On the server, RLX.TriggerClientEvent(name, target, ...), where target is a source, a list of sources, or -1 for everyone.