warxander / warmenu

FiveM Lua Menu Framework
https://forum.cfx.re/t/free-warmenu-lua-menu-framework
ISC License
44 stars 31 forks source link

Menu wont open for the second time. #26

Closed reiniervg closed 3 months ago

reiniervg commented 3 months ago

I created a menu, and the issue is that when I press the F6 key, the menu opens. Great! When I click a button, it works and closes the menu. That's all fine. But now, when I press F6 to open the menu for the second time, I hear the menu button click sound, but the menu doesn't pop up. Also, there are no errors in the console or server console.

reiniervg commented 3 months ago

I managed to fix the issue. When a button is pressed, it calls a function located in another file named functions.lua. I found that if I place that function directly in menu.lua (where the menu is), it works fine and the menu opens and closes as expected. However, I would like to keep the function in functions.lua. Is there something else I can try to ensure it works correctly when the function is in that file?

warxander commented 3 months ago

Try to adjust client scripts load order by editing fxmanifest.lua (place functions.lua before menu script).

reiniervg commented 3 months ago

That fixed the issue, Thanks! And if i may ask when i open the menu my CPU msec is going up to 0.35 MS and 26% Time, is there something that i can do to optimise it?

warxander commented 3 months ago

There is an overhead of graphics API usage, but it shouldn't affect FPS that much.

reiniervg commented 3 months ago

Allright, i know enough then. Thanks!