[Release][Dev] NativeUILua

Am not understanding sorry

can you send a screenshot of the f8 ?

Sure @Karl https://gyazo.com/fd217c776d9d04ac284d14aa6d6ec026

Thank you for this release :+1:

Just wondering if it’s possible to load images in the menu?
(For example, if I was to have a vehicle spawner with an image of the said vehicle.)

How Would i add multiple items that trigger events inside that??

function AddMenuVehicle(menu)
    local submenu = _menuPool:AddSubMenu(menu, "Vehicle")
    for i = 1, 1 do
    	local Item = NativeUI.CreateItem("Lock Vehicle", "")
		Item.Activated = function(ParentMenu, SelectedItem)
    		--Do stuff
    		TriggerEvent('lock')
    	end
        submenu:AddItem(Item)
    end
end

Could you update the provided example on how to use the new panels and what not, this would really help a lot of people out as it’s not documented very well.

Still an Error for me when I click on one of the arrows of the panel :

[   4915250] Error resuming coroutine: client/ExternalScripts/NativeUI.lua:1269: attempt to index a number value (field '?')
[   4915250] stack traceback:
[   4915250] 	client/ExternalScripts/NativeUI.lua:1269: in method 'FindPanelItem'
[   4915266] 	client/ExternalScripts/NativeUI.lua:2126: in method 'UpdateParent'
[   4915266] 	client/ExternalScripts/NativeUI.lua:2153: in method 'UpdateSelection'
[   4915281] 	client/ExternalScripts/NativeUI.lua:2109: in method 'CurrentSelection'
[   4915281] 	client/ExternalScripts/NativeUI.lua:2226: in method 'Functions'
[   4915297] 	client/ExternalScripts/NativeUI.lua:2244: in method 'Draw'
[   4915297] 	client/ExternalScripts/NativeUI.lua:3263: in method 'Draw'
[   4915313] 	client/ExternalScripts/NativeUI.lua:3757: in method 'Draw'
[   4915313] 	client/ExternalScripts/NativeUI.lua:3735: in method 'ProcessMenus'
[   4915328] 	client/Characters/Skin.lua:130: in function <client/Characters/Skin.lua:128>
local function AddAppearanceMenu()
		local menu = _menuPool:AddSubMenu(mainMenu, "Apparence")
		local hairColorSelection = 1
		local HairsMenu = NativeUI.CreateListItem("Cheveux", Hairs, SkinObject.GetHairs() + 1, "Choisissez Votre Coupe de Cheveux")
		menu:AddItem(HairsMenu)
		local ColorPanel = NativeUI.CreateColourPanel("Couleur", HairsColor)
		HairsMenu:AddPanel(ColorPanel)
		if SkinObject.GetSex() == 0 then
			--local BeardMenu = NativeUI.CreateListItem("Barbe")
		end
		menu.OnListChange = function(sender, item, index)
			if item == HairsMenu then
				SkinObject.SetHairs(index - 1)
			end
		end
	end

	AddHeritageMenu()
	AddAppearanceMenu()
	_menuPool:RefreshIndex()

	mainMenu:Visible(true)

	Citizen.CreateThread(function()
		while _menuPool:IsAnyMenuOpen() do
			_menuPool:ProcessMenus()
			Citizen.Wait(1)
		end
	end)

How to edit background and description color?

I keep getting the "Couldn’t load resource error. How do I fix this?

How would I go about making a bit that allows me to enter custom text?

I.e. it comes up when activated with a textbox that I can type in

Hi frazzle i’m using the code you provided me… i was wondering…

using this code you gave me some time ago

function AddMenuGPSMenu(menu)
    local gps = {
		"Nessuno",
        "Centro per l'Impiego",
		"Stazione di polizia",
        "Ospedale",
		"Banca",
		"Negozio d'armi",
        "Negozio di animali",
        "Concessionario",
        "Parcheggio",
		"Negozio di Abbigliamento",
		"Barbiere"
	}
	local newitem = NativeUI.CreateListItem("GPS Veloce", gps, 1, "Imposta la tua destinazione")
	newitem.OnListChanged = function(ParentMenu, SelectedItem, Index)
		local Item = SelectedItem:IndexToItem(Index)
		if Item == "Nessuno" then
			ClearGpsPlayerWaypoint()
		elseif Item == "Centro per l'impiego" then
			local centro = GetFirstBlipInfoId(407)
			local blipX = 0.0
			local blipY = 0.0
			if (centro ~= 0) then
				local coord = GetBlipCoords(centro)
				blipX = coord.x
				blipY = coord.y
				SetNewWaypoint(blipX, blipY)
			end	
		elseif Item == "Stazione di polizia" then
			local centro = GetFirstBlipInfoId(60)
			local blipX = 0.0
			local blipY = 0.0
			if (centro ~= 0) then
				local coord = GetBlipCoords(centro)
				blipX = coord.x
				blipY = coord.y
				SetNewWaypoint(blipX, blipY)
			end
		end
	end
	menu:AddItem(newitem)
end

the item get selected and the function get called right after i change item… how can i make it that the player has to actually press return to select the option he wants to?

fixed using OnListSelected

but now i have a problem… when i use Item4 i get the effect of using Item5… like if there’s only item5 existing

		local Item4 = NativeUI.CreateListItem("Alza/Abbassa finestrini", finestrini, 1, "Alza e abbassa i finestrini del veicolo")
		submenu.OnListSelect = function(ParentMenu, SelectedItem, Index)
			finestrini = SelectedItem:IndexToItem(Index)
			TriggerEvent('lpmenu:finestrini', finestrini)
		end
		local Item5 = NativeUI.CreateListItem("Apri/Chiudi Portiere", portiere, 1, "Apri e chiudi le portiere della tua macchina")
		submenu.OnListSelect = function(ParentMenu, SelectedItem, Index)
			portiere = SelectedItem:IndexToItem(Index)
    		TriggerEvent('lpmenu:portiere', portiere)
    	end

use OnListSelected ? instead of OnListChanged

Yup this way instead of having an effect when selecting it I have to press return to make the thing go on… like on GTA online

newitem.OnListChanged = function(ParentMenu, SelectedItem, Index) change it to newitem.OnListSelected = function(ParentMenu, SelectedItem, Index)

1 Like

Thank you :slight_smile:

Can you please an example “NativeUI.CreateColourPanel” to change hair color

the problem now is making esx work

I am having issues with the NativeUI. Since they took down Mello Trainer i am trying to use the EasyAdmin menu but i am having issues getting it working.

resource_manifest_version '05cfa83c-a124-4cfa-a768-c24a5811d8f9'

--[[
--All items unpacked

client_scripts {
    "Utils.lua",
    "elements/UIResRectangle.lua",
    "elements/UIResText.lua",
    "elements/Sprite.lua",
    "elements/StringMeasurer.lua",
    "elements/Badge.lua",
    "elements/Colours.lua",
    "items/UIMenuItem.lua",
    "items/UIMenuCheckboxItem.lua",
    "items/UIMenuListItem.lua",
    "items/UIMenuSliderItem.lua",
    "items/UIMenuColouredItem.lua",
    "items/UIMenuprogressItem.lua",
    "windows/UIMenuHeritageWindow.lua",
    "panels/UIMenuGridPanel.lua",
    "panels/UIMenuColourPanel.lua",
    "panels/UIMenuPercentagePanel.lua",
    "UIMenu.lua",
    "MenuPool.lua",
    "MenuExample.lua",
}

--All items packed
--]]

client_script "@NativeUI/NativeUI.lua"
client_script "NativeUI.lua"

In the read me it says to put client_script “@NativeUI/NativeUI.lua” in the _resource.lua so i did that, but still nothing. And on the EasyAdmin page HERE, it says Required Resources: NativeUI. Is there an installation tutorial on youtube or how can i get this working.

This is better asked in the EasyAdmin Topic, you dont have to edit NativeUI at all, nor do you have to edit EasyAdmin, literally just install the NativeUI Resource as NativeUI and add it to the autostart, done.