Skip to content

Exports, events, and commands ​

Use the client exports to play cosmetic emotes from another resource. For server-forced playback, use the server exports. Calls that fail return false plus a reason where applicable.

Client exports ​

lua
local emotes = exports.np_emotes

local ok, reason, handle = emotes:play('coffee', { source = 'my_resource' })
emotes:stop() -- stop the current emote

if emotes:isPlaying() then
  local current = emotes:getCurrent()
end

emotes:lock('my_resource', { stop = true })
emotes:unlock('my_resource')
emotes:setWalkstyle('move_m@brave')
emotes:setMood('mood_happy_1')
emotes:openMenu('gestures')

The client API also includes isBusy, isLocked, getWalkstyle, getMood, clearWalkstyle, clearMood, closeMenu, isMenuOpen, openWheel, openPlacement, requestShared, registerEmotes, getEmote, and search. See the resource README for method signatures and return values.

Server exports ​

lua
local emotes = exports.np_emotes

local ok, reason = emotes:playOn(playerId, 'wave', { force = false })
emotes:stopOn(playerId, 'scene-ended')
emotes:lockPlayer(playerId, 'cutscene')
emotes:unlockPlayer(playerId, 'cutscene')
local current = emotes:getPlayerEmote(playerId)

Server exports also include isPlayerLocked, registerEmotes, unregisterEmotes, getEmote, getRegistryHash, and addHook. playOn respects locks, blocked player states, restricted-emote rules, and registered veto hooks.

Hooks are named canPlay, canShare, and canPlace; a hook can veto an action by returning false, 'reason'. Hooks registered by an addon are removed when its owner resource stops.

Local events ​

The client emits np_emotes:started (id, info), np_emotes:stopped (id, reason), np_emotes:sharedStarted, np_emotes:sharedEnded, np_emotes:walkstyleChanged (set), and np_emotes:moodChanged (id).

Commands ​

/e, /emote, /emotes, /walk, /walks, /mood, /nearby, /anim (staff), and /emotecreator (staff). Players can change registered keys in FiveM's key bindings.