CallEvent: Difference between revisions
From Onset Developer Wiki
No edit summary |
No edit summary |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{Info|Function|Server & Client|1.0}} | {{Info|Function|Server & Client|1.0}} | ||
{{FuncDescription| | {{FuncDescription|The event to call by name. Will call events in all packages.}} | ||
{{FuncSyntax|CallEvent(EventName [, UserArgs])}} | {{FuncSyntax|CallEvent(EventName [, UserArgs...])}} | ||
{{FuncParameters}} | {{FuncParameters}} | ||
{{FuncParam|EventName | | {{FuncParam|EventName|The event name.}} | ||
{{FuncParamOptional|UserArgs| | {{FuncParamOptional|UserArgs|The passed user arguments to the function.}} | ||
{{FuncReturnValue| | {{FuncReturnValue|This function has no specific return value.}} | ||
== Example == | == Example == | ||
<syntaxhighlight lang="Lua> | |||
function SetPlayerLoggedIn(player) | |||
PlayerData[player].logged_in = true | |||
SetPlayerRandomColor(player) | |||
CallEvent("OnPlayerLoggedIn", player) | |||
end | |||
</syntaxhighlight> | |||
{{RelatedFunctions}} | {{RelatedFunctions}} | ||
* [[CallEvent]] | |||
* [[AddEvent]] | |||
* [[CallRemoteEvent]] | |||
* [[BroadcastRemoteEvent]] | |||
* [[AddRemoteEvent]] |
Latest revision as of 17:07, 30 December 2020
Description
The event to call by name. Will call events in all packages.
Syntax
CallEvent(EventName [, UserArgs...])
Parameters
- EventName
The event name. - UserArgs (optional)
The passed user arguments to the function.
Return Value
- This function has no specific return value.
Example
function SetPlayerLoggedIn(player)
PlayerData[player].logged_in = true
SetPlayerRandomColor(player)
CallEvent("OnPlayerLoggedIn", player)
end