AddEvent
Jump to navigation
Jump to search
addEvent
Declares a custom event for the current resource.
Syntax
bool addEvent(string eventName [, bool allowRemoteTrigger = false])
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
eventName |
string |
yes | The custom event name, up to 128 bytes. |
allowRemoteTrigger |
bool |
no | Whether the event may be triggered across the client/server boundary. |
Returns
Returns true when the event is declared successfully. On the server it returns false if the event was already declared.
Examples
Declare a server event that clients may trigger:
addEvent("inventory:request", true)
Notes
- Available in both client-side and server-side resource scripts.
- Only enable remote triggering for events whose arguments and permissions are validated by the receiver.