Shopping Cart
FiveM script 11abac85b780a6bfb422bb414511bacab31e72a7

[How-to] Make Multiple Item Types & MORE in NativeUI – Modding Tutorials


To make Multiple Item Types in NativeUI you must have each Item Type in the same Function and not separated. A example of which is as follows.

function Weapons(menu)
local submenu = _menuPool:AddSubMenu(menu, "Weapons Menu", "Sub Menu for Weapons") 
local gunsList = NativeUI.CreateListItem("Get Weapons", weapons, 1)
  submenu.OnListSelect = function(sender, item, index)  
      if item == gunsList then
          local selectedGun = item:IndexToItem(index)
          giveWeapon(selectedGun)
          notify("Gave Weapon: "..selectedGun)
    end
  end
    local click = NativeUI.CreateItem("~r~Clear Weapon(s)", "Clears Peds Weapons")
    local weapon = NativeUI.CreateItem("~b~Give all Weapons")
    submenu.OnItemSelect = function (sender, item, index)
      if item == click then
        RemoveAllPedWeapons(GetPlayerPed(-1), true)
        notify("~r~Removed All Weapon(s)")
      else if item == weapon then
        giveWeapon("weapon_knife")
      end
  end
end
submenu:AddItem(gunsList)
submenu:AddItem(weapon)
submenu:AddItem(click)
end

If you were to then go on and make a new submenu you can go on and do that in a seperate Function, but to have multiple of the same types in one submenu you must keep that in one single function with if and elseif statements.

NOTE: If you have any questions feel free to comment them, I am open for discussion. This is not the most in-depth because itโ€™s not to to hardโ€ฆ but if you are confused (New to Programming) that is understandable and I am there to help.

Leave a Reply

Your email address will not be published. Required fields are marked *

FiveM ESX Scripts

The best scripts and maps

Best support

Problems? We are there to help!

Wide range of products

We have a wide range of products

100% Secure Checkout

Stripe