AddEvent: Difference between revisions

From Wiki G1R-MP G1 Remake Multiplayer
Jump to navigation Jump to search
Automatyczna aktualizacja dokumentacji funkcji
 
Complete Lua function catalog
Line 30: Line 30:
* 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.


[[Category:Lua Functions]]
[[Category:Shared Functions]]
[[Category:Shared Functions]]
[[Category:Event Functions]]
[[Category:Event Functions]]

Revision as of 09:52, 15 August 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.