REE.Lib.Anim - REE-FiveM/ree-core GitHub Wiki

REE.Lib.Anim

These functions are helper functions for interacting with player animations and emotes.

Example: Playing an Emote

For this example, we're going to register a client command that plays the smoking emote when called. We're going to assume that you already have the REE instance. This script will make the player take out a cigarette, play the animation for around 30 seconds, and then drop it.

example/client.lua

RegisterCommand("smoke", function()
  Citizen.CreateThread(function()
    local ped = GetPlayerPed(-1)
    REE.Lib.Anim.PedPlayEmote(ped, "SMOKE")
    Citizen.Wait(30 * 1000) -- wait 30s and then stop smoking
    REE.Lib.Anim.PedStopEmote(ped)
  end)
end)

PedPlayEmote(ped, emoteName, immediately)

This will start an emote task on the player, but it will also automatically handle removing their weapon (but not losing it). You can provide an additional immediately parameter, to cancel the current animation (will stop mid-frame, and drop any props).

Parameters:

  • ped (float) - The player ped to play the emote on
  • emoteName (string) - The name of the emote (from the REE.Data.Emotes constants)
  • immediately (nil, boolean) - Play the emote immediately or queue like normal

PedStopEmote(ped, immediately)

This will stop any playing emote task. If immediately is provided, it will stop immediately. (This also helps with getting out of some bugged scripts).

Parameters:

  • ped (float) - The player ped to stop the emote on
  • immediately (nil, boolean) - If true, stop the current emote immediately