[ad_1]
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.
[ad_2]