AddRemoteEvent: Difference between revisions
From Onset Developer Wiki
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{Info|Function|Server & Client|1.0}} | {{Info|Function|Server & Client|1.0}} | ||
{{FuncDescription| | {{FuncDescription|The remote event to call from either server to client or vice versa.}} | ||
{{FuncSyntax|AddRemoteEvent(player, RemoteEventName, LuaFunction)}} | {{FuncSyntax|AddRemoteEvent(player, RemoteEventName, LuaFunction)}} |
Revision as of 15:16, 17 November 2019
Description
The remote event to call from either server to client or vice versa.
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)