Triggers an event on the specified client(s), and passes on any additional arguments.
TriggerClientEvent(string eventName, int playerId[, ...])
-- CLIENT
Lua's traditional way to register a net event and add an event handler:
RegisterNetEvent("eventName")
-- The event handler function follows after registering the event first.
AddEventHandler("eventName", function(eventParam1, eventParam2)
-- Code here will be executed once the event is triggered.
end)
Lua's simplified way:
RegisterNetEvent("eventName", function(eventParam1, eventParam2)
-- Code here will be executed once the event is triggered.
end)
-- SERVER
TriggerClientEvent('eventName', playerId, 'Hello world!')