Skip to content

feat(extra-natives-five): add Lua support for scripted animation data buffers - #4011

Open
Rogui20 wants to merge 10 commits into
citizenfx:masterfrom
Rogui20:master
Open

feat(extra-natives-five): add Lua support for scripted animation data buffers#4011
Rogui20 wants to merge 10 commits into
citizenfx:masterfrom
Rogui20:master

Conversation

@Rogui20

@Rogui20 Rogui20 commented May 31, 2026

Copy link
Copy Markdown

Goal of this PR

Allow Lua scripts to call TASK_SCRIPTED_ANIMATION and PLAY_ENTITY_SCRIPTED_ANIM using data buffers that contain animation dictionary and clip name strings.

These natives expect structures containing char* fields, which are currently difficult to populate from Lua without exposing raw pointers to scripts or implementing native-specific wrappers.
...

How is this PR achieving the goal

This PR adds support for inline string markers inside binary buffers passed to scripted animation natives.

When a buffer contains a string marker in the form:

__cfx_str:

the marker is resolved into a temporary native string and replaced with a valid char* before the native is executed.

This allows Lua scripts to build the animation initialization structure entirely from script-side data while keeping string pointer creation inside the runtime.

The implementation was designed specifically to support the structures used by:

TASK_SCRIPTED_ANIMATION
PLAY_ENTITY_SCRIPTED_ANIM

without exposing raw memory addresses to scripts.
...

This PR applies to the following area(s)

FiveM
Natives
ScRT: Lua
...

Successfully tested on

Game builds: ..
3095
Platforms: Windows, Linux
Windows 10

Testing included:

Single animation slots
Multiple animation slots
Empty animation slots
Animation dictionary and clip string resolution
TASK_SCRIPTED_ANIMATION
PLAY_ENTITY_SCRIPTED_ANIM

Checklist

  • Code compiles and has been tested successfully.
  • Code explains itself well and/or is documented.
  • My commit message explains what the changes do and what they are for.
  • No extra compilation warnings are added by these changes.

Fixes issues

None.

This PR adds Lua support for passing animation initialization data containing string fields to scripted animation natives.

@github-actions github-actions Bot added the invalid Requires changes before it's considered valid and can be (re)triaged label May 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

invalid Requires changes before it's considered valid and can be (re)triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant