AddEvent: Difference between revisions
Jump to navigation
Jump to search
Automatyczna aktualizacja dokumentacji funkcji |
Document expanded scripting capacities and complete audited limits for 0.1.3 BUILD81 |
||
| (One intermediate revision by the same user not shown) | |||
| Line 1: | Line 1: | ||
= addEvent = | = addEvent = | ||
Declares a custom event for the current resource. | Declares a custom event for the current resource. | ||
| Line 29: | Line 28: | ||
* Available in both client-side and server-side resource scripts. | * 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. | * Only enable remote triggering for events whose arguments and permissions are validated by the receiver. | ||
* Expanded limits apply from update 0.1.3 BUILD81. Client limit: 4096 declared remote event names per resource; the server has no matching fixed declaration-count cap. See [[Scripting limits]]; earlier 0.1.3 binaries retain their old limits. | |||
[[Category:Lua Functions]] | |||
[[Category:Shared Functions]] | [[Category:Shared Functions]] | ||
[[Category:Event Functions]] | [[Category:Event Functions]] | ||
Latest revision as of 11:51, 12 September 2026
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.
- Expanded limits apply from update 0.1.3 BUILD81. Client limit: 4096 declared remote event names per resource; the server has no matching fixed declaration-count cap. See Scripting limits; earlier 0.1.3 binaries retain their old limits.