AddRemoteEvent: Difference between revisions

From Onset Developer Wiki
No edit summary
28days (talk | contribs)
No edit summary
Line 3: Line 3:
{{FuncDescription|__EDIT_ME__}}
{{FuncDescription|__EDIT_ME__}}


{{FuncSyntax|AddRemoteEvent(RemoteEventName, LuaFunction)}}
{{FuncSyntax|AddRemoteEvent(player, RemoteEventName, LuaFunction)}}
{{FuncSyntaxClient|AddRemoteEvent(RemoteEventName, LuaFunction)}}


{{FuncParameters}}
{{FuncParameters}}
{{FuncParam|RemoteEventName|__EDIT_ME__}}
{{FuncParam|player|The player identifier.}}
{{FuncParam|LuaFunction|__EDIT_ME__}}
{{FuncParam|RemoteEventName|The remote event name.}}
{{FuncParam|LuaFunction|The lua function.}}


{{FuncReturnValue|This function has no specific return value.}}
{{FuncReturnValue|This function has no specific return value.}}


== Example ==
== Example ==
__EDIT_ME__
<syntaxhighlight lang="Lua">
-- Client side
AddRemoteEvent("SetWeather", function(weatherid)
    SetWeather(weatherid)
end)
 
-- Server side
AddCommand("we", function(playerid, weatherid)
    CallRemoteEvent(playerid, "SetWeather", weatherid)
end)
</syntaxhighlight>


{{RelatedFunctions}}
{{RelatedFunctions}}
__EDIT_ME__
* [[CallEvent]]
* [[CallRemoteEvent]]
* [[AddRemoteEvent]]

Revision as of 15:15, 17 November 2019

AddRemoteEvent

Type: Function
Context: Server & Client
Introduced: v1.0

Description

__EDIT_ME__

Syntax

AddRemoteEvent(player, RemoteEventName, LuaFunction)
Client Syntax
AddRemoteEvent(RemoteEventName, LuaFunction)

Parameters

  • player
    The player identifier.
  • RemoteEventName
    The remote event name.
  • LuaFunction
    The lua function.

Return Value

  • This function has no specific return value.

Example

-- Client side
AddRemoteEvent("SetWeather", function(weatherid)
    SetWeather(weatherid)
end)

-- Server side
AddCommand("we", function(playerid, weatherid)
    CallRemoteEvent(playerid, "SetWeather", weatherid)
end)

See also