DocsLua scripting
Events
Listen for and send events between resources on the server.
lua
AddEventHandler('name', function(...) ... end)
TriggerEvent('name', ...) -- to all resources on the server#Built-in events
| Event | When |
|---|---|
playerJoining(id, name) | A player has joined. |
playerDropped(id, name) | A player has left the server. |
onResourceStart(resourceName) | A resource has started. |
onResourceStop(resourceName) | A resource is stopping. |
Players are identified by a whole number: the player id.
#Arguments
Arguments are sent as JSON between resources, so use numbers, strings, booleans and tables. Functions and userdata can't be sent.
lua
AddEventHandler('onResourceStart', function(res)
if res == GetCurrentResourceName() then
print('I have started!')
end
end)Tip
To talk to players, use net events instead.
Last updated 2026-12-06