NUI C# Displaying

,

I’m hoping someone can help me out. I’m trying to figure out the NUI in C#.

Html file:
https://pastebin.com/PKsMhpTn

Nothing is displayed when I try to activate it with:
if (Game.IsControlJustPressed(0, Control.Cover))
{
string messageString = “{“enable”:true}”;
SetNuiFocus(true, false);
SendNuiMessage(messageString);
}

I am properly escaping my string, the site is just removing the back slash

<script>
 
if(event.data.enable == true) {
  document.body.style.display = "block";
} else {
  document.body.sytle.display = "none";
}
</script>

This only gets ran once… look at the NUI w/ mouse example. It shows how to set NUI up properly.

1 Like

Awesome thanks, I’ve got it to work, now to just figure out how to use RegisterNuiCallbackType() in C#

Where is the example? (I assume it is C#?)

@Kreag Look on my github and you can see an example of C# and NUI. Look for FiveZ on my github repos.

Github link is on my forum profile.