AddRemoteEvent: Difference between revisions

From Onset Developer Wiki
28days (talk | contribs)
No edit summary
JanHolger (talk | contribs)
No edit summary
Line 3: Line 3:
{{FuncDescription|The remote event to call from either server to client or vice versa.}}
{{FuncDescription|The remote event to call from either server to client or vice versa.}}


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


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

Revision as of 12:48, 19 November 2019

AddRemoteEvent

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

Description

The remote event to call from either server to client or vice versa.

Syntax

AddRemoteEvent(RemoteEventName, LuaFunction)

Parameters

  • 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