[Release] NativeUI port for pΛ

Here is a ported version of NativeUI for usage in your client scripts. Credits to Guad.


client_script 'nativeui.net.dll'
client_script 'menuexample.net.dll' -- For the example script, press Z to toggle menu

Load this before the scripts that use it and make sure the name ends with .net.dll.

Please download the source code here:

Please take a look at the modified MenuExample script to find out how it works. Small questions can be asked here, but don’t make it too complicated.


Awesome now I don’t have to do it ;D

An issue I’ve found so far is there seems to be no delay between key press registration. Unless i tap an arrow key quickly and release it, the selection moves 2 or more items at once.

After the newest server files update I noticed that Instructional Buttons started to appear on my menus. I have not noticed them before and never used them so this was new to me. Also it seems now that the first time you run the server Instructional Buttons don’t appear but upon restarting resource containing these buttons they start appearing. Even if I try to add Instructional Buttons through DisableInstructionalButtons function they won’t appear untill I restart resource atleast once.

The other thing I noticed, which also started happening after server files update, was the appearance of delay between key press registration while going through the menus, the lack of @Marxy explained. Although this delay only appears occasionally after restart of the resource with NativeUI menus.

It would be really nice if both of these things would appear all the time upon starting the server.

Hello @everyone,

I looked few exemples of menus and saw that they have all been written in C#, would it be possible to get a way to call them thanks to Lua please?

If it is already possible an exemple written in Lua would be much appreciated! :slight_smile:

I did some searchs on the forums and I saw that I can also use NUI but I crappy skills in HTML/Javascript/CSS and I really like the fresh design of those GTA-looking menus. And writting my own menu script would not worth it because it would not look as good as NativeUI.

Thank you.

@potassium Hey men, I wanted to install the menu example on my server today and I can’t figure out which files I need to compile and which files I need to configure to make the menu working .
It will be very usefull if someone got the solution ? It will be very usefull

Anyone know the solution ? :confused:

Hey @Twiikerz, what did you do already ? You got Visual Studio installed ?

@Skeleton, You can use events to trigger actions from the menu, so you can interact with LUA’s server and client scripts.

In MenuExample.cs :

TriggerEvent("myEvent", "I am a cake"); // Client Event
TriggerServerEvent("myEvent", "I am a cake"); // Server Event

To catch them, in client.lua :

AddEventHandler('myEvent', function(text)

And for the server event :


AddEventHandler('myEvent', function(text)

@eliakoh Thank you but I was not talking about this, it seems that the menu can only be coded in C#.

Yes the menu is made in C#, but you can interact with Lua thanks to events, I thought that’s what you wanted.

Sorry if I misunderstood.

@eliakoh I’m not sure to understand, I know what are events but I don’t think I can run the C# functions thanks to events. Do you have an exemple (one with the menu)

If you want to trigger events from C# it’s the code I previously given. For the other way around, you’ll need to declare the event in the C# class constructor with :

EventHandlers["eventName"] += new Action<dynamic>(FunctionName);

Then you’ll need a FunctionName inside your C# class to receive the event. Finally, you can TriggerClientEvent from LUA and it’ll call the C# function.

Thanks for your support guys I’ll try to adapt the Inventory which is actually released in the NativeUI Menu which is working on my server right now, I just have to configure the buttons .


I added the nativeUI.net.dll as a reference and copied the MenuExample code in my .cs file but the menu does not show up.
I also added “using NativeUI;”

I have another public class that shows a notification as a test when I’m pressing a key and it works fine.

What could cause the problem ?


Please make sure that when loading the .dll files in your script you load
nativeui.net.dll before yourscript.net.dll

For instance

client_script "nativeui.net.dll"
client_script "yourscript.net.dll"

This is a very common mistake that causes the issue. If it continues, please post your code somewhere and we’ll see where it goes from there.

That’s indeed what I did. The code is the same as the MenuExample found on GitHub :confused:

I also have the same issue.

I’ve downloaded CitizenFX/NativeUI and loaded it in Visual Studio 2017 Community.
I’ve removed the post-build event for NativeUI that copy the files in the resource directory.

Building Release NativeUI: No error (some warning about obsolete functions btw) -> file NativeUI.dll
Building Release MenuExample: No error -> file MenuExample.dll

As suggested here, I changed the assemblies names to nativeui.net(.dll) and menuexample.net(.dll) and rebuilt the projects.

I copied theses files in my resource and ensured that nativeui.net.dll was loaded before menuexample.net.dll.

In game, nothing happens when I press F5 (as this part suggest):

if (e.KeyCode == Keys.F5 && !_menuPool.IsAnyMenuOpen()) // Our menu on/off switch
      mainMenu.Visible = !mainMenu.Visible;

I tried another resource (VehicleControls) which embed its own nativeui.net.dll.
This resource works well alone.

If I replace its nativeui.net.dll with mine, it doesn’t work anymore.
If I use its nativeui.net.dll with my menuexample.net.dll, it doesn’t work either.

So, my files are the problem here but I don’t know what to do since I kept the original source code and I don’t have any build issue…

EDIT: I though the last release was the most up to date and clean version of NativeUI for citizenfx but I guess I was wrong…
Using the content of the repository seems to fix a lot of issues and make things more logical with what I’ve seen around.

However I still cannot get it to work…

EDIT 2: I managed to create a menu via dll but using nativeui.net.dll from Scammer’s VehicleControl script.
The one I build still doesn’t work. Do I need to specify CPU type? I tried forcing it to x64 but no luck.

1 Like

looks nice and all but how do i implement this into my server, because i’m trying to use simple zombies .net and i’ve already tried using the standard Native UI so now that i have the Native UI master from the link what do i do now?

how can i exchange this for the standard gui of vrp ?

1 Like

@potassium Sorry for the bump, but have you guys seen, or had any reports, of some players getting lag/freezing when they first open a NativeUI menu?

My system will pause for half a second the very first time I open a menu, and then after that, it’s fine. On every subsequent attempt to open the menu, it opens instantly with no delay. And even that first pause is very brief, and it’s barely noticeable…not even to annoy me at all.

But I’ve had some players report that they get more serious freezing rather than just a brief pause, and in some extreme cases, they get a full game crash.

It’s super intermittent, which makes it hard to diagnose, and I can’t even duplicate it on my system aside from that brief pause.

Is there anything that can/should be done in regards to pre-loading NativeUI asynchronously on startup or something?

On startup, I initialize the menu pool and the menu, just like in the example. In the Tick event, I call ProcessMenus(), provided that the menu and menu pool have been initialized. Everything is fine and happy until menu.Visible changes from false to true. And like I said, it only has that “lazy loading” type pause on the very first time the user opens the menu; after that it’s lightning quick, and most people have nothing more than a brief pause.

Is there anything that I’m missing? Let me know if you need a code snippet.