ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Client events
  3. onClientRender

Event

onClientRender

ClientDrawing (dx)Identical to MTA:SA

Triggered every game frame. This is where you draw everything that should stay on screen: HUD, counters, text.

Handler

addEventHandler("onClientRender", root, function() ... end)

Source

source is root.

Example

A clock with the real time in the top-right corner of the screen.

local sw = guiGetScreenSize()

addEventHandler("onClientRender", root, function()
    local time = getRealTime()
    dxDrawText(("%02d:%02d"):format(time.hour, time.minute), 0, 20, sw - 30, 60, tocolor(255, 255, 255), 1.6, "pricedown", "right")
end)

Notes

Every millisecond counts. The handler runs on every frame, e.g. 60 times a second. Do not create fonts, textures or tables in it. Prepare them once, outside the event.

See also