onClientPreRender | Multi Theft Auto: Wiki Skip to content

onClientPreRender

Client-side
Server-side
Shared

This event is triggered every time before GTA renders a new frame.

Parameters

float timeSlice
  • timeSlice: The interval between this frame and the previous one in milliseconds (delta time).

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.

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