Command Palette
Search for a command to run...
EXPORTS & EVENTS#
This guide explains how to utilize events and exports with the onex-emotes script. It assists you in opening menus, fetching data, and loading player models.
IMPORTANT NOTE ➤ You should be familiar with Lua and the basics of FiveM events and exports. It's also helpful to have some basic knowledge of HTML and CSS.
OPEN MENU#
Use this event or export to open the emote menu.
TriggerEvent('onex-emotes:client:OpenMenu')
Example#
-- Play the 'wave' emote from all categories exports['onex-emotes']:PlayEmote('all_emotes', 'wave', false, false, false)
IS MENU OPEN?#
return value : boolean
--return boolean exports['onex-emotes']:isMenuOpen()
PLAY EMOTE#
With this event or export, you can play any emote without needing to open the menu. It is useful for animations like eating food or other scenarios.
ARGUMENTS :
category:string- EXAMPLE VALUE:
all_emotesorvalid_emote_categ
You can also use
all_emotesas the category, so you don't need to specify each time which category your desired emote belongs to.- EXAMPLE VALUE:
emote_name:string
ped:number(optional)If you set this to
false, it will use the default valuePlayerPedId(). To have a different player/ped play the animation, specify that player/ped.
coords:vector3(optional)A vector3 representing the coordinates where the emote will be played. As this is optional, you can also set it to
false, which will play the emote at the player's current position.
rotation:vector3(optional)A vector3 representing the rotation of the player. When the emote is played, the ped's rotation will change if this value is not false/nil. You can also set it to
false, which will use the player's current rotation.
-- category : string, emote_name : string, ped : number, coords : vector3, rotation : vector3 TriggerEvent('onex-emotes:client:PlayEmote' , categ, ename, ped, coords, rot)
CANCEL EMOTE#
Cancel playing animation.
-- force : boolean(optional) TriggerEvent('onex-emotes:client:CancelEmote' , force)
[GET/SET]CAN CANCEL EMOTE?#
Use this export to get whether the emote can be canceled right now.
-- boolean TriggerEvent('onex-emotes:client:setCanCancelEmote' , boolean)
Set the state to determine if the emote can be canceled at this moment, either by a trigger or by the player.
exports['onex-emotes']:CanCancelEmote()
[SET/GET]CAN PLAYER PLAY EMOTE#
You can use this to block or unblock the emote from playing.
ARGUMENTS :
canplay:boolean
-- canplay : boolean TriggerEvent('onex-emotes:client:setCanPlayEmote' , boolean)
Use this export to know can player right now play emote or not.
ARGUMENTS :
canplay:boolean
-- canplay : boolean exports['onex-emotes']:CanPlayEmote()
HANDLE WALK STYLE#
Use this export to change current walk style.
RESET WALK STYLE :
For resetting walk style to default , pass walk_styleName argument value to reset.
walk_styleName : string --> reset
exports['onex-emotes']:setWalkstyle(walk_styleName)
Use this to restore the walking style. If you've reset the walking style for a task and want to reapply the previously saved style, you can achieve that with this export.
exports['onex-emotes']:restoreWalkStyle()
HANDLE EXPRESSION#
Use this export to change current expression.
RESET EXPRESSION :
For resetting expression to default , pass expression_name argument value to reset.
expression_name : string --> reset
exports['onex-emotes']:setExpression(expression_name)
Use this to restore the face expression. If you've reset the expression for a task and want to reapply the previously saved style, you can achieve that with this export.
exports['onex-emotes']:restoreExpression()
GET EMOTES OBJECT#
To access the Emotes object, inside onex-emotes/shared/emotes.lua.
exports['onex-emotes']:RetrieveEmotes()
[SET/GET]EMOTE SETTINGS STATE#
This is the Emote Menu's upper section:

If a player has enabled or disabled any of these options via the menu, you can also control these settings programmatically through an event.
USE CASE: Suppose you are playing a food animation, and you need to enable or disable the movement button accordingly. You can achieve this by setting up the configuration as shown below.
-- types -> [key : string] : [value(true/false) : string] local Settings = { ["canmovealways"] = 'true', ["emoteloop"] = 'false', ["upperbody"] = 'true', ["preview"] = 'false', } exports['onex-emotes']:setEmoteSettingState(Settings)
If you don’t want to modify a particular setting, such as emoteloop, simply exclude it from the Settings table. For instance, if you only want to control the upperbody setting, you can do so like this:
-- types -> [key : string] : [value(true/false) : string] local Settings = { ["upperbody"] = 'true', } exports['onex-emotes']:setEmoteSettingState(Settings)
It will help you to know the current player settings whether it's canmovealways or any other setting.
KEYS ARE:
canmovealwaysemoteloopupperbodypreview
It will RETURN : string
-- key : string exports['onex-emotes']:getEmoteSettingState(key)