M MY Multiplayer: Wiki
Side
Kind

setElementMatrix

Shared

Places and turns an element from a matrix.

bool setElementMatrix(element element, table matrix)

Parameters

NameTypeDescription
elementelementThe element.
matrixtableA table of 4 rows of 4 numbers, like the one getElementMatrix returns: right, forward, up and position. The fourth column is ignored.

Returns

true if it applied, false if the element has no position and rotation or the matrix gives values that are not finite.

Example

local vehicle = getPedOccupiedVehicle(localPlayer)
if vehicle then
    local matrix = getElementMatrix(vehicle)
    matrix[4][3] = matrix[4][3] + 2
    setElementMatrix(vehicle, matrix)
end
NoteA table without 4 rows of 4 finite numbers raises an error.

See also