Hello, How to send "SendNUIMessage" one on another resource

Hello, i have a problem
I want send a “SendNUIMessage”.
Has an external resource but impossible it does not work

Do you have a solution ?

Example:
I have a command “SendNUIMessage” in a resource name “roadTruck”.
I want it to interact with the file ui.html on the html resource “road”

You can trigger an event and listen for it in the ui resource or export a function.
I can show you an example if you don’t understand.

I want an example, Thanks

Ok, so in the resource with the html file, inside a client side lua file, you would add

AddEventHandler("eventname", function(dataArray)
    SendNUIMessage("message", dataArray)
end)

Then inside the other resource, when you want to interact with the html file, you would call

TriggerEvent("eventname", dataArray)

I believe this is what you were asking for, I’m not sure If I completely understand your question.

You could also accomplish the same thing by exporting a function from the ui resource.

3 Likes

It’ s a good suggestion thank you

1 Like

SendNUIMessage use the memory server or its not working in server ?
Its a fonction unique client ?

1 Like