BroadcastRemoteEvent: Difference between revisions
From Onset Developer Wiki
Created page with "{{Info|Function|Server|1.0}} {{FuncDescription|This function has the same functionality as CallRemoteEvent. The difference is that this function can call a remote event o..." |
No edit summary |
||
Line 1: | Line 1: | ||
{{Info|Function|Server|1.0}} | {{Info|Function|Server|1.4.0}} | ||
{{FuncDescription|This function has the same functionality as [[CallRemoteEvent]]. The difference is that this function can call a remote event on all connected players. | {{FuncDescription|This function has the same functionality as [[CallRemoteEvent]]. The difference is that this function can call a remote event on all connected players. |
Latest revision as of 17:12, 30 December 2020
Description
This function has the same functionality as CallRemoteEvent. The difference is that this function can call a remote event on all connected players.
See CallRemoteEvent for detailed explanations and limitations.
Syntax
BroadcastRemoteEvent(EventName [, LuaArgs...])
Parameters
- EventName
The name of the remote event as a string which was explicit defined by AddRemoteEvent. - UserArgs (optional)
Arguments to pass to the remote event.
Return Value
- Returns true on success or false on an error.
Example
Script on the server:
function OnPlayerJoin(player)
-- Calls the remote event "ServerCallsMe" on all connected players.
BroadcastRemoteEvent("PlayerJoin", player)
end
AddEvent("OnPlayerJoin", OnPlayerJoin)
Script on the client:
function PlayerJoin(player)
AddPlayerChat("Server called PlayerJoin("..player..")")
end
AddRemoteEvent("PlayerJoin", PlayerJoin)