addEventHandler
Function
Server and Client
Online and Offline
void addEventHandler(string eventName, function handler)
Parameters
1) | string | eventName | The name of the event, case-insensitive. |
2) | function | handler | The scripting function to call when the event occurs. |
Return
void | This function doesn't return a value. |
Callbacks
function handler(Event event, [...])
1) | Event | event | The event object. |
2) | ... | vararg | The arguments specific to the eventName .
|
Notes
Examples
Example 1 - JavaScript:
addEventHandler('onPedWasted', function(event, ped, attacker, weapon, piece) { if(ped.isType(ELEMENT_PLAYER)) { message(ped.name + ' has died.'); } else { message('A ped has died.'); } });
Compatibility
There isn't any compatibility information for this function.
Related
Server Related
addEvent
addEventHandler
bindEventHandler
removeEventHandler
triggerEvent
triggerNetworkEvent
unbindEventHandler
Client Related
addEvent
addEventHandler
bindEventHandler
removeEventHandler
triggerEvent
triggerNetworkEvent
unbindEventHandler