Use this to listen for events, see the events page for more info.
AddEventHandler(string eventName, function callback)
- eventName: The name of the event you want to listen to.
- callback: The function to run when the event is called.
Don’t forget to RegisterNetEvent!
AddEventHandler('eventName', function(text) print(('I just received %s from %i'):format(text, source)) -- I just received Hello world! from (player id) -- source is a global variable (Player's id) end)
TriggerServerEvent('eventName', 'Hello world!')
Last modified May 22, 2020: AddEventHandler example and invalid url fix (427d9fe)