RedM Natives

TASK_PLAY_ANIM

Animations list This is the server-side RPC native equivalent of the client native TASK_PLAY_ANIM.

Hash0x5AB552C6
Runtime nameTaskPlayAnim
NamespaceCFX
SideServer
NameOfficial
Docs

Signature

void TASK_PLAY_ANIM(Ped ped, char* animDictionary, char* animationName, float blendInSpeed, float blendOutSpeed, int duration, int flag, float playbackRate, BOOL lockX, BOOL lockY, BOOL lockZ);

Parameters

NameTypeDescription
pedPed

The ped you want to play the animation

animDictionarychar*

The animation dictionary

animationNamechar*

The animation name

blendInSpeedfloat

The speed at which the animation blends in. Lower is slower and higher is faster, 1.0 is normal, 8.0 is basically instant

blendOutSpeedfloat

The speed at which the animation blends out. Lower is slower and higher is faster, 1.0 is normal, 8.0 is basically instant

durationint

The duration of the animation in milliseconds. -1 will play the animation until canceled

flagint

The animation flags (see enum)

playbackRatefloat

The playback rate (between 0.0 and 1.0)

lockXBOOL—
lockYBOOL—
lockZBOOL—

Returns void

Description

Cfx.re native reference

Animations list

enum eScriptedAnimFlags
{
AF_LOOPING = 1,
AF_HOLD_LAST_FRAME = 2,
AF_REPOSITION_WHEN_FINISHED = 4,
AF_NOT_INTERRUPTABLE = 8,
AF_UPPERBODY = 16,
AF_SECONDARY = 32,
AF_REORIENT_WHEN_FINISHED = 64,
AF_ABORT_ON_PED_MOVEMENT = 128,
AF_ADDITIVE = 256,
AF_TURN_OFF_COLLISION = 512,
AF_OVERRIDE_PHYSICS = 1024,
AF_IGNORE_GRAVITY = 2048,
AF_EXTRACT_INITIAL_OFFSET = 4096,
AF_EXIT_AFTER_INTERRUPTED = 8192,
AF_TAG_SYNC_IN = 16384,
AF_TAG_SYNC_OUT = 32768,
AF_TAG_SYNC_CONTINUOUS = 65536,
AF_FORCE_START = 131072,
AF_USE_KINEMATIC_PHYSICS = 262144,
AF_USE_MOVER_EXTRACTION = 524288,
AF_HIDE_WEAPON = 1048576,
AF_ENDS_IN_DEAD_POSE = 2097152,
AF_ACTIVATE_RAGDOLL_ON_COLLISION = 4194304,
AF_DONT_EXIT_ON_DEATH = 8388608,
AF_ABORT_ON_WEAPON_DAMAGE = 16777216,
AF_DISABLE_FORCED_PHYSICS_UPDATE = 33554432,
AF_PROCESS_ATTACHMENTS_ON_START = 67108864,
AF_EXPAND_PED_CAPSULE_FROM_SKELETON = 134217728,
AF_USE_ALTERNATIVE_FP_ANIM = 268435456,
AF_BLENDOUT_WRT_LAST_FRAME = 536870912,
AF_USE_FULL_BLENDING = 1073741824
}

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

Usage

Lua
TaskPlayAnim(ped, animDictionary, animationName, blendInSpeed, blendOutSpeed, duration, flag, playbackRate, lockX, lockY, lockZ)

-- always works, by hash
Citizen.InvokeNative(0x5ab552c6, ped, animDictionary, animationName, blendInSpeed, blendOutSpeed, duration, flag, playbackRate, lockX, lockY, lockZ)
JavaScript and C#
JavaScript
TaskPlayAnim(ped, animDictionary, animationName, blendInSpeed, blendOutSpeed, duration, flag, playbackRate, lockX, lockY, lockZ);

// by hash
Citizen.invokeNative('0x5ab552c6', ped, animDictionary, animationName, blendInSpeed + 0.0000001, blendOutSpeed + 0.0000001, duration, flag, playbackRate + 0.0000001, lockX, lockY, lockZ);
C#
Function.Call((Hash)0x5ab552c6, ped, animDictionary, animationName, blendInSpeed, blendOutSpeed, duration, flag, playbackRate, lockX, lockY, lockZ);
  • 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.

Enums and flags

Sources

Cfx.re native reference

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