triggerEvent: Difference between revisions

From GTA Connected
Jump to navigation Jump to search
No edit summary
No edit summary
 
(One intermediate revision by the same user not shown)
Line 6: Line 6:
|arg1 = string eventName The name of the event, case-insensitive.
|arg1 = string eventName The name of the event, case-insensitive.
|arg2 = [Element source = null] The source element to trigger the event for, used in [[bindEventHandler|bindEventHandler]] but not in [[addEventHandler|addEventHandler]].
|arg2 = [Element source = null] The source element to trigger the event for, used in [[bindEventHandler|bindEventHandler]] but not in [[addEventHandler|addEventHandler]].
|arg3 = [mixed vararg = null] Arguments to be sent to scripting function that are bound to the event.
|arg3 = [vararg ... = null] Arguments to be sent to scripting function that are bound to the event.
|return1 = void
|return1 = void
|returnFail1 = void
|returnFail1 = void

Latest revision as of 12:10, 5 January 2023

Function Server and Client icon-iii.png icon-vc.png icon-sa.png icon-iv.png Online and Offline

Available since Server 1.0.0, Client 1.0.0

void triggerEvent(string eventName, [ Element source = null] The source element to trigger the event for, used in bindEventHandler but not in [[addEventHandler|addEventHandler] ], [ vararg ... = null ])

The triggerEvent function is used to trigger an event, which is only triggered on the same endpoint (server or client).
Use triggerNetworkEvent for script communication between client and server or vice versa.

Parameters

1) string eventName The name of the event, case-insensitive.
2) Element source Optional, defaults to null] The source element to trigger the event for, used in bindEventHandler but not in [[addEventHandler|addEventHandler]. .
3) vararg ... Optional, defaults to null. Arguments to be sent to scripting function that are bound to the event.

Return

void This function doesn't return a value.

Callbacks

string eventName(CancellableEvent event, vararg ...)

1) CancellableEvent event The event object.
2) vararg ... The mixed vararg arguments that were sent to triggerEvent.
Note that the source element is not forwarded to the callbacks.


Notes

There aren't any notes for this function.

Examples

There aren't any examples for this function.

Compatibility

There isn't any compatibility information for this function.

Related

Server Related

icon-iii.png icon-vc.png icon-sa.png icon-iv.png addEvent
icon-iii.png icon-vc.png icon-sa.png icon-iv.png addEventHandler
icon-iii.png icon-vc.png icon-sa.png icon-iv.png bindEventHandler
icon-iii.png icon-vc.png icon-sa.png icon-iv.png removeEventHandler
icon-iii.png icon-vc.png icon-sa.png icon-iv.png triggerEvent
icon-iii.png icon-vc.png icon-sa.png icon-iv.png triggerNetworkEvent
icon-iii.png icon-vc.png icon-sa.png icon-iv.png unbindEventHandler


Client Related

icon-iii.png icon-vc.png icon-sa.png icon-iv.png addEvent
icon-iii.png icon-vc.png icon-sa.png icon-iv.png addEventHandler
icon-iii.png icon-vc.png icon-sa.png icon-iv.png bindEventHandler
icon-iii.png icon-vc.png icon-sa.png icon-iv.png removeEventHandler
icon-iii.png icon-vc.png icon-sa.png icon-iv.png triggerEvent
icon-iii.png icon-vc.png icon-sa.png icon-iv.png triggerNetworkEvent
icon-iii.png icon-vc.png icon-sa.png icon-iv.png unbindEventHandler