TriggerServerEvent

From Wiki G1R-MP G1 Remake Multiplayer
Revision as of 12:53, 4 August 2026 by QCherry (talk | contribs) (Automatyczna aktualizacja dokumentacji funkcji)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

triggerServerEvent

Sends a reliable ordered resource event from the local client to the server.

Syntax

bool triggerServerEvent(string eventName, element sourceElement, ...)

Parameters

Name Type Required Description
eventName string yes The server event name, up to 128 bytes.
sourceElement element yes The event source; normally root.
... nil/bool/number/string no Values sent with the event.

Returns

Returns true when the event is queued for transmission; otherwise returns false.

Examples

Request an item from the server:

triggerServerEvent("inventory:requestItem", root, "ITMW_1H_SWORD_01")

Notes

  • Available only in client-side resource scripts.
  • The server must declare the event with addEvent(eventName, true) and validate the true sender before changing authoritative state.
  • The authenticated sender's player ID is passed to the server handler before the values supplied by the client.