Hooks
The Hooks Handler system for cdev_emotemenu allows you to register callbacks that will be executed when specific events occur within the emote menu system. This provides a powerful way to extend funct
Available Hooks
The following hooks are currently available:
onAnimationStart: Triggered when an animation begins playingonAnimationCancel: Triggered when an animation is canceled
Exports
addHook
Description: Registers a callback function to be executed when a specific hook is triggered.
Parameters:
hookName (string): The name of the hook to register for ('onAnimationStart' or 'onAnimationCancel')
callback (function): The callback function to execute when the hook is triggered
Usage:
exports['cdev_emotemenu']:addHook('onAnimationStart', function(animData, person)
print("Animation started: " .. animData.label)
-- Your code here
end)removeHook
Description: Removes a previously registered callback function from a specific hook.
Parameters:
hookName (string): The name of the hook to remove the callback from
callback (function): The callback function to remove
Usage:
callHook
Description: Manually triggers a specific hook, executing all registered callbacks.
Parameters:
hookName (string): The name of the hook to trigger
... (any): Additional parameters to pass to the callback functions
Usage:
Hook Callback Parameters
onAnimationStart
Callback parameters:
animData (table): data about the animation
person (string): 'firstperson' or 'secondperson'
Example:
onAnimationCancel
Callback parameters:
ped (number): Ped
Example:
Example Usage
Last updated