What is the equivalent function to “RegisterServerEvent” and “RegisterNetEvent” in javascript?
RegisterServerEvent("vRP:event")
AddEventHandler("vRP:event", function()
--mycode
end)
What is the equivalent function to “RegisterServerEvent” and “RegisterNetEvent” in javascript?
RegisterServerEvent("vRP:event")
AddEventHandler("vRP:event", function()
--mycode
end)
The equivalent function would be onNet or on depending were you expect the event to be emitted from (called from server or client side).
So, if you want to listen to events from the client on the server then you would do something like this:
onNet("myResource:printMyString", (myString) => {
console.log(`My string: ${myString}`);
});