Gestures and emotes
Check hands up and pointing, play and stop emotes by name, and see which emote script answers, whatever emote menu the server runs.
Hands up, pointing and emotes come from an emote script. ai-core asks whichever one runs, so a police search ("are their hands up?") or a job animation works with any of them.
Two lists are kept apart, because not every script does both:
- Gestures (hands up, pointing): tgiann-emotes, codem-emotemenu, rpemotes (and rpemotes-reborn), 0r-animmenu, ai-smallresources. The first one running in this order answers.
- Emotes (play by name, stop): tgiann-emotes, rpemotes (and rpemotes-reborn), scully_emotemenu, dpemotes. The first one running in this order answers.
IsHandsUp
Tells whether the local player has their hands up, in whichever emote script answers gestures.
Side: Client · Waits: no
IsHandsUp(): booleanlocal up = exports['ai-core']:IsHandsUp() -- or aiLib.gestures.isHandsUp()Parameters
None.
Returns
boolean: true while the hands are up. false when they are not, or when no gesture script runs.
Example
import { gestures, notify } from "@aicore-fivem/lib/client";
import { Locale } from "common";
RegisterCommand(
"surrender_check",
() => notify(Locale(gestures.isHandsUp() ? "HANDS_UP" : "HANDS_DOWN")),
false,
);This reads the local player only. To know whether another player has their hands up (a robbery, a search), ask the server, which asks that player's client.
IsPointing
Tells whether the local player is pointing, in whichever emote script answers gestures.
Side: Client · Waits: no
IsPointing(): booleanlocal pointing = exports['ai-core']:IsPointing() -- or aiLib.gestures.isPointing()Parameters
None.
Returns
boolean: true while pointing. false when not, when no gesture script runs, or when the running one cannot tell (0r-animmenu has no pointing check).
Example
import { gestures } from "@aicore-fivem/lib/client";
RegisterCommand("ispointing", () => console.log(gestures.isPointing()), false);GetGestureProvider
Returns the resource name of the emote script that answers hands up and pointing.
Side: Client · Waits: no
GetGestureProvider(): string | nulllocal provider = exports['ai-core']:GetGestureProvider() -- or aiLib.gestures.provider()Parameters
None.
Returns
string: the resource name ("tgiann-emotes"). null when none of the supported scripts runs.
Example
import { gestures } from "@aicore-fivem/lib/client";
// Use your own hands-up key only when no emote script offers one.
if (gestures.provider() === null) console.log("no gesture script, enabling my own hands-up key");PlayEmote
Plays an emote of the running emote script by its command name, the name players type after /e ("sit", "notepad").
Side: Client · Waits: no
PlayEmote(name: string): booleanlocal played = exports['ai-core']:PlayEmote(name) -- or aiLib.gestures.playEmote(name)Parameters
Prop
Type
Returns
boolean: true when the name is valid and an emote script was asked to play it. false for an invalid name or when no emote script runs. true does not prove the emote exists in that script: an unknown name simply plays nothing.
Example
import { gestures, progress } from "@aicore-fivem/lib/client";
import { Locale } from "common";
// Writes a note with the notepad emote while the bar runs.
export async function writeNote(): Promise<boolean> {
gestures.playEmote("notepad");
const done = await progress({ label: Locale("WRITING"), duration: 5000, canCancel: true });
gestures.cancelEmote();
return done;
}CancelEmote
Stops the emote the local player is playing, in the running emote script. Use it when your script needs the player's hands (cuffing, a knock-down, a minigame).
Side: Client · Waits: no
CancelEmote(): booleanlocal stopped = exports['ai-core']:CancelEmote() -- or aiLib.gestures.cancelEmote()Parameters
None.
Returns
boolean: true when an emote script was asked to stop (also when nothing was playing), false when no emote script runs.
Example
See the example of PlayEmote.
GetEmoteProvider
Returns the resource name of the emote script that plays emotes by name.
Side: Client · Waits: no
GetEmoteProvider(): string | nulllocal provider = exports['ai-core']:GetEmoteProvider() -- or aiLib.gestures.emoteProvider()Parameters
None.
Returns
string: the resource name ("rpemotes"). null when none of the supported emote scripts runs.
Example
import { gestures, player } from "@aicore-fivem/lib/client";
// Prefer the server's emote script, fall back to a plain animation.
export function sitDown(): void {
if (gestures.emoteProvider() !== null) gestures.playEmote("sit");
else void player.playAnim("anim@amb@business@bgen@bgen_no_work@", "sit_phone_phoneputdown_idle_nowork");
}