Events & callbacks
Adding event listeners
To add an event listener, use the client.add_event_listener function. Any amount of callbacks can be added, there is no limit.
local function on_paint(frame)
end
client.add_event_listener('paint', on_paint)
Removing event listener
Once you're done with an event listener, use the client.remove_event_listener function to stop receiving callbacks.
local function on_paint(frame)
end
local listener = client.add_event_listener('paint', on_paint)
client.remove_event_listener('paint', listener)
eventpaint(frame)
paint
This callback is run every time a new frame is being rendered. You can use the renderer functions to draw to the screen here.
Avoid running any intensive tasks in your paint callback as it can drastically affect performance
Callback parameters
- Name
frame- Type
- number
- Description
- Current frame number being rendered
Example
local ref = client.add_event_listener('paint', function()
renderer.text(50, 50, 255, 255, 255, 255, 'Hello world!')
end)