TriggerClientEvent: Difference between revisions
Jump to navigation
Jump to search
Automatyczna aktualizacja dokumentacji funkcji |
Complete Lua function catalog |
||
| Line 34: | Line 34: | ||
* The client resource must declare the event with <code>addEvent(eventName, true)</code>. Network arguments are limited to nil, boolean, number and string. | * The client resource must declare the event with <code>addEvent(eventName, true)</code>. Network arguments are limited to nil, boolean, number and string. | ||
[[Category:Lua Functions]] | |||
[[Category:Server Functions]] | [[Category:Server Functions]] | ||
[[Category:Network Functions]] | [[Category:Network Functions]] | ||
[[Category:Event Functions]] | [[Category:Event Functions]] | ||
Latest revision as of 09:55, 15 August 2026
triggerClientEvent
Sends a reliable ordered resource event from the server to one player or all players.
Syntax
bool triggerClientEvent(root|int target, string eventName, element sourceElement, ...)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
target |
int | yes | Use a player id for one client, or root/nil to broadcast. |
eventName |
string |
yes | The client event name. |
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
Display a client notification for one player:
triggerClientEvent(playerId, "ui:notification", root, "Quest completed")
Notes
- Available only in server-side resource scripts.
- The client resource must declare the event with
addEvent(eventName, true). Network arguments are limited to nil, boolean, number and string.