Skip to content

RegisterNetEvent

Register a net event that can be called by the client or the server,
The event have the AddEventHandler already loaded

Argument Data Type Needed Default Description
EventName string - The name of the event
Function function - The code executed when the event was triggered

Dont need to be called every frame


Example
RegisterNetEvent("utility_libs:ILoveYou", function()
    print(GetPlayerName().." love the utility_libs, how to blame it?")
end)
Old method
RegisterNetEvent("utility_libs:ILoveYou")
AddEventHandler("utility_libs:ILoveYou", function()
    print(GetPlayerName(PlayerId()).." love the utility_libs, how to blame it?")
end)
Using old native

although i dont recommend it, you can use the old native via old_RegisterNetEvent


Last update: April 12, 2022
Created: June 27, 2021