[Release][Dev] NativeUILua

How would I change the banner I pasted the Rectangle banner code in and NativeUI wouldn’t open

is it possible to close the menu with an exit button i tried

function AddMenuexit(menu)
    local submenu = _menuPool:AddSubMenu(menu, "Exit Menu")
    for i = 1, 1 do
    	local Item = NativeUI.CreateItem("Exit", "Exit the menu")
		Item.Activated = function(ParentMenu, SelectedItem)
		exitmenu()
			end
		submenu:AddItem(Item)
		_menuPool:MouseControlsEnabled(false, false)
		_menuPool:ControlDisablingEnabled(false)
      end
end

function code:

function exitmenu()
	mainMenu:Visible(false)
end

but it’s not working for some reason i hear the click but nothing happens if i set false to true it another version of the menu over the current one

I don’t understand the nativeui and i did everything correct,when i start the server i get: Could not find dependency NativeUI for resource AddOnVehicleSpawnMenu.Someone got an idea how can i fix it?

where do i put the file?

I’m working on a police menu based on NativeUILua and was wondering how you disable the mouse and mouse cursor?

add this at the top

_menuPool:MouseControlsEnabled(false)
_menuPool:ControlDisablingEnabled(false)

Also add it to the bottom where you have refreshindex()

2 Likes

Thanks! I’ll try it out.

Hello, I was wondering if I could trigger esx events and fetch values from my database, is it possible ?

2 Likes

Hey how do you add a submenu into a submenu?

Hi, I would need a code for a teleport player to a certain position.

Why fiveM send this message ‘’ Couldn’t load resource NativeUI from resources:/NativeUI/. " went I try to connect…Can you help me to install or result this probleme. THX

Hey there,

Make sure your NativeUI is in your resources folder and the nativeui folder is named NativeUI.
Also, i suggest you to use: https://github.com/iTexZoz/NativeUILua_Reloaded That project is actually being developed, the NativeUILua project was discontinued.

2 Likes

I am having a hard time understand where to put this and how to put it.

Oh nice i didn’t know there was a reloaded version. I just changed to that version and works nicely. Just had to change the way subitem works on this new version. Thanks!

I have 2 questions I haven’t found an answer yet
Is there anyway to run a command?
Is there anyway to run an emote from a list?

Hello How to get a mysql info and list them ? thanks

I’m trying to set up a menu where the name of the button is a string variable, and I’m not sure how, or if it is at all possible. Setting the string variable in the lua file and using it as the name works fine, but I can’t take the string from an input like a command and have it actively change. Does anybody have any ideas? I’ve tried using _menuPool:RefreshIndex() after the variable is set by the command, but that had no effect. Thanks!

How would one make it so the only way to view a submenu (ex local submenu = _menuPool:AddSubMenu(menu, “Admin Menu”, “Sub Menu for Admin Related Options”)?

I have it set so only certain people with the Admin Ace Perm can use the functionality within the SubMenu, but I want it so that same permission can only view that SubMenu.

Here is a Example

function Admin(menu)
  local submenu = _menuPool:AddSubMenu(menu, "Admin Menu", "Sub Menu for Admin Related Options")
  local godmode = NativeUI.CreateItem("~r~God Mode [On]", "Gives Player Ped God Mode")
  local godmode2 = NativeUI.CreateItem("~r~God Mode [Off]", "Removes Player Ped God Mode")
  local gone = NativeUI.CreateItem("~r~Invisible [On]", "Gives Player Ped Invisibility")
  local gone2 = NativeUI.CreateItem("~r~Invisible [Off]", "Removes Player Ped Invisibility")
  submenu:AddItem(godmode)
  submenu:AddItem(godmode2)
  submenu:AddItem(gone)
  submenu:AddItem(gone2)
  submenu.OnItemSelect = function(sender, item, index)
  if item == godmode then 
    if allowedToUse then
      SetEntityInvincible(GetPlayerPed(-1), true)
      notify("~g~God Mode On")
    else
      notify("~r~You don't have permission")
    end
    else if item == godmode2 then
    if allowedToUse then
      SetEntityInvincible(GetPlayerPed(-1), false)
      notify("~r~God Mode Off")
    else
      notify("~r~You don't have permission.")
    end
    else if item == gone then
    if allowedToUse then
      SetEntityVisible(GetPlayerPed(-1), false)
      notify("~g~Player is Invisible")
    else
      notify("~r~You dont have permission")
    end
    else if item == gone2 then
    if allowedToUse then
      SetEntityVisible(GetPlayerPed(-1), true)
      notify("~r~Player no longer Invisible")
    else
      notify("~r~You dont have permission")
    end
            end
          end
        end
      end
    end
  end

I have tried myself but only know how to make it so only people with X perm can open the menu in general, but that wont work because I want it to also work without permissions.

Yes there is.

Citizen.CreateThread(function()
    while true do
        Citizen.Wait(0)
        _menuPool:ProcessMenus()
        if IsControlJustPressed(1, 167) then
		    if allowedToUse then
            mainMenu:Visible(not mainMenu:Visible())
end
        end
    end
end)

already achieved this. also note if you didn’t look on the github already it has been

Discontinued

someone else has picked it up though on https://github.com/iTexZoz/NativeUILua-Reloaded

@ImBaphomet is the author of the newer version.

2 Likes