onClientRender | Multi Theft Auto: Wiki Skip to content

onClientRender

Client-side
Server-side
Shared

This event is triggered every time GTA renders a new frame. It is required for the DirectX drawing functions, and also useful for other clientside operations that have to be applied repeatedly with very short time differences between them.

Parameters

This event does not pass any parameters to the handler function.

Source

element: The source of this event is the client's root element.

Code Examples

client

This example makes the camera follow the player in a GTA2-like way. This will be a little bit laggy. If you want the camera to follow something (eg. player or vehicle) then useonClientPreRenderinstead.

function updateCamera()
local x, y, z = getElementPosition(localPlayer)
setCameraMatrix(x, y, z + 50, x, y, z)
end
addEventHandler("onClientRender", root, updateCamera)