ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Client functions
  3. dxDrawModel3D

Function

dxDrawModel3D

Draws a game object model at a spot for one frame: without collision, hidden by the world. It does not work for peds and vehicles. The first frame of a new model waits until the game loads it. At most 64 objects at once.

Syntax

bool dxDrawModel3D(int modelID, float x, y, z, float rx, ry, rz [, float scale = 1, float lighting])

Arguments

modelIDint
Object model.
x, y, zfloat
Position.
rx, ry, rzfloat
Rotation.
scalefloat, optional = 1
Scale.
lightingfloat, optional
Accepted for compatibility with existing scripts.

Differences from MTA:SA

  • These MTA:SA arguments are not here: float scaleZ = 1, float lighting = 0

In MTA:SA

dxDrawModel3D(int modelId, float positionX, float positionY, float positionZ, float rotationX, float rotationY, float rotationZ, float scaleX = 1, float scaleY = 1, float scaleZ = 1, float lighting = 0)

Returns

true if drawn or the model is loading.

Example

A preview of an object being placed in front of the player (e.g. in a map editor).

addEventHandler("onClientRender", root, function()
    local x, y, z = getElementPosition(localPlayer)
    dxDrawModel3D(1271, x, y + 3, z - 0.5, 0, 0, getTickCount() / 10 % 360)
end)

See also