From the reference libraryRedM

autodoc_client_functions

jo_libs/modules/game-events/autodoc/autodoc_client_functions.md

autodoc_client_functions

JO Functions > jo.gameEvents.listen()

Register a listener for a specific game event <br>

JO Functions > jo.gameEvents.listen() > Syntax

jo.gameEvents.listen(eventName, callback)

JO Functions > jo.gameEvents.listen() > Parameters

eventName : string

The name of the event to listen for, or "all" to listen for all events

callback : function

The function that will be called when the event is triggered

JO Functions > jo.gameEvents.listen() > Example

jo.gameEvents.listen("EVENT_ENTITY_DAMAGED", function(data)
    print("Target:", data.target_entity)
    print("Origin:", data.initiator_entity)
    print("Weapon:", data.weapon)
    log(data)
end)

Back to documentation