[Release] NativeUI port for pΛ

@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 .

Hi.

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 ?

Thanks

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.

2 Likes

Sorry to bother you, it works well but I’m wondering if I can use it outside of the resource too? I want multiple resources that depend on NativeUI but I don’t want to cram them into the nativeUI resource. I load them after nativeUI and also of course have added them as a reference in visual studio. It works at compile time but when loading the resource it can’t find nativeui. I know I can use exports but a direct reference should be possible too right?

BigMessageHandler does not work (all)

For example
new BigMessageHandler().ShowSimpleShard(text, desc, time);

Can you guys update the fork to add the 1.8 changes from guad?
There have been some fixes and additions that I really want to see on FiveM.

how to i change the key binding

How to resolve this.


Indicator.

I have installed the source code and placed NativeUI into my resources/ folder and used start NativeUI in my server.cfg. I also created the __resource.lua in the folder like so:

resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937'
client_script 'nativeui.net.dll'
client_script 'menuexample.net.dll'

but when launching my server it seems to put me in fine and when I hit Z it doesn’t do anything.

I think its not working for me