bindEventHandler: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 10: | Line 10: | ||
|return = void | |return = void | ||
|freturn = void | |freturn = void | ||
|note = [[Server/Events|Server Events]] | |note = [[Server/Events|Server Events]] | ||
[[Client/Events|Client Events]] | |note2 = [[Client/Events|Client Events]] | ||
|cb3arg1 = Event event The event object. | |cb3arg1 = Event event The event object. | ||
|cb3arg2 = ... vararg The arguments specific to the <code>eventName</code>. | |cb3arg2 = ... vararg The arguments specific to the <code>eventName</code>. | ||
|exampleJS = bindEventHandler("OnResourceStart", thisResource, function(event, resource) | |||
{ | |||
message('Resource ' + resource.name + ' has started.'); | |||
}); | |||
}} | }} | ||
Latest revision as of 19:30, 15 June 2026
Function Server and Client
![]()
Online and Offline
Available since Server 1.0.0, Client 1.0.0
void bindEventHandler(string eventName, handle source, function handler)
The bindEventHandler function is used to add a handler to call when an event occurs for the source item.
Parameters
| 1) | string | eventName | The name of the event, case-insensitive. |
| 2) | handle | source | The source element. |
| 3) | function | handler | The scripting function to call when the event occurs for the source element. |
Return
| void | This function doesn't return a value. |
Callbacks
function handler(Event event, ... vararg)
| 1) | Event | event | The event object. |
| 2) | ... | vararg | The arguments specific to the eventName.
|
Notes
Examples
Example 1 - JavaScript:
bindEventHandler("OnResourceStart", thisResource, function(event, resource)
{
message('Resource ' + resource.name + ' has started.');
});
Compatibility
There isn't any compatibility information for this function.
Related
Server Related
addEvent
addEventHandler
bindEventHandler
removeEventHandler
triggerEvent
unbindEventHandler
event.description
event.name
Client Related
addEvent
addEventHandler
bindEventHandler
removeEventHandler
triggerEvent
unbindEventHandler