ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Shared functions
  3. setElementRotation

Function

setElementRotation

Sets the element's rotation in degrees. On the client it turns your own character in the same frame (no teleport) and client objects.

Syntax

bool setElementRotation(element theElement, float rotX, float rotY, float rotZ)

Arguments

theElementelement
The element.
rotXfloat
X rotation.
rotYfloat
Y rotation.
rotZfloat
Z rotation (heading).

Differences from MTA:SA

  • These MTA:SA arguments are not here: string rotOrder = "default", bool conformPedRotation = false

In MTA:SA

setElementRotation(element theElement, float rotX, float rotY, float rotZ, string rotOrder = "default", bool conformPedRotation = false)

Returns

true on success.

Example

addCommandHandler("odwroc", function(player)
    local veh = getPedOccupiedVehicle(player)
    if veh then
        local _, _, rz = getElementRotation(veh)
        setElementRotation(veh, 0, 0, rz)
    end
end)

See also