RedM Natives

SET_ENTITY_ROTATION

Sets the rotation of a specified entity in the game world.

Hash0xA345EFE
Runtime nameSetEntityRotation
NamespaceCFX
SideServer
NameOfficial
Docs

Signature

void SET_ENTITY_ROTATION(Entity entity, float pitch, float roll, float yaw, int rotationOrder, BOOL bDeadCheck);

Parameters

NameTypeDescription
entityEntity

The entity to rotate.

pitchfloat

The pitch (X-axis) rotation in degrees.

rollfloat

The roll (Y-axis) rotation in degrees.

yawfloat

The yaw (Z-axis) rotation in degrees.

rotationOrderint

Specifies the order in which yaw, pitch, and roll are applied, see GET_ENTITY_ROTATION for the available rotation orders.

bDeadCheckBOOL

Usually set to true. Determines whether to check if the entity is dead before applying the rotation.

Returns void

Description

Cfx.re native reference

Sets the rotation of a specified entity in the game world.

NativeDB Introduced: v323

This is the server-side RPC native equivalent of the client native SET_ENTITY_ROTATION.

Usage

Lua
SetEntityRotation(entity, pitch, roll, yaw, rotationOrder, bDeadCheck)

-- always works, by hash
Citizen.InvokeNative(0xa345efe, entity, pitch, roll, yaw, rotationOrder, bDeadCheck)
JavaScript and C#
JavaScript
SetEntityRotation(entity, pitch, roll, yaw, rotationOrder, bDeadCheck);

// by hash
Citizen.invokeNative('0xa345efe', entity, pitch + 0.0000001, roll + 0.0000001, yaw + 0.0000001, rotationOrder, bDeadCheck);
C#
Function.Call((Hash)0xa345efe, entity, pitch, roll, yaw, rotationOrder, bDeadCheck);
  • Float parameters: Lua integers (10, or whole numbers decoded from NUI/JSON) are sent as ints and read as garbage. Write 10.0 or value + 0.0. The generated JS wrappers add 0.0000001 to non-zero floats for the same reason.

See also

Sources

Cfx.re native reference

Something wrong or missing? Contribute a verified note — corrections ship through pull requests.