[Release][Dev] NativeUILua

Not an issue with NativeUI.
Start NativeUI before EasyAdmin in your server.cfg.

so i was making a radar like DoJRP’s new one but everytime i open the menu and toggle the action once it doesn’t want to open again unless i restart the NativeUI Resource any idea??

Does toggling the action/radar close the thread that is running ProcessMenus()? Or perhaps there’s a problem with your Visible() logic.

when i toggle the on checkmark it closees it and enables the radar but then i can’t open it again

here’s the code i have:

	function AddMenuRadar2(menu)
    local newitem = NativeUI.CreateCheckboxItem("On", radar, "Turn your radar on!")
    menu:AddItem(newitem)
    menu.OnCheckboxChange = function(sender, item, checked_)
        if item == newitem then
            radar = checked_
			TriggerClientEvent("toggleSMenu")
        end
    end
end
radar = false

^ that’s all the way at the top

I can’t see anything here that would prevent the menu from reopening after executing this code. It doesn’t seem to care if the radar is active or not either. The problem is either somewhere else in the menu code or there’s some sort of issue with what happens with that client event.

How to get the index of a ColorPanel, i’m mostly new at lua but i’ll try to rebuild a Charakter Creation like gta:o

If someone know how i’ll get the index of a colorPanel and of a gridPanel i would realy appreciate that

LG

UIMenuColourPanel:CurrentSelection()
UIMenuGridPanel:CirclePosition()
UIMenuPercentagePanel:Percentage()

1 Like

can i add this to my anyone can be cop server?

I mean, nothing is stopping you. You’d have to code it.

thank you for your help with the needed values.

the colorPanel works great but i got an error with the percentagePanel

in your function at line 2297

function UIMenuPercentagePanel:Percentage(Value)
    if tonumber(Value) then
        local Percent = ((Value < 0.0) and 0.0) or ((Value > 1.0) and 1.0 or Value)
        self.ActiveBar:Size(self.BackgroundBar.Width * Percent, self.ActiveBar.Height)
    else
        local Progress = (math.round(GetControlNormal(0, 239) * 1920) - SafeZone.X) - self.ActiveBar.X
        return math.round(((Progress >= 0 and Progress <= 413) and Progress or ((Progress < 0) and 0 or 413))/self.BackgroundBar.Width, 2)
    end
end

i use a 21:9 screen with 2560x1080. maybe this is some kind of a thing why i get this error in the SaveZone 2297: attempt to index a nil value (global "SaveZone’)

Fixed it in the latest commit

tyvm great work

if you got some time is it possible to get the menu fully running with my 21:9 screen? it looks a little wide and the mouse controls are anywhere outside left of the menu.

but all i can say until now it’s a realy nice menu. i love it

LG

can u pm me screenshots of whats messed up

I don’t know why, but only the second slider works :confused: It seems like we can’t have 2 sliders in one menu.

function AddMenuLivery(menu)
    local extra = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}
    local newitem = NativeUI.CreateListItem("Extra", extra, 1)
    menu:AddItem(newitem)
    menu.OnListChange = function(sender, item, index)
        if item == newitem then
            dish = item:IndexToItem(index)
            ShowNotification("Extra 1~r~" .. dish)
        end
    end

    local extra2 = {0,1,2,3,4,5,6,7,8,9}
    local newitem = NativeUI.CreateSliderItem("Extra", extra2, 1, false)
    menu:AddItem(newitem)
    menu.OnSliderChange = function(sender, item, index)
        if item == newitem then
            quantity = item:IndexToItem(index)
            ShowNotification("Extra 2~r~" .. quantity)
        end
    end
end

That’s because you have two OnSliderChange functions listening for the same variable, which is overwrites the variable from the first slider.

Try something more like this:

function AddMenuLivery(menu)
    local extra = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}
    local newitem = NativeUI.CreateListItem("Extra", extra, 1)
    menu:AddItem(newitem)

    local extra2 = {0,1,2,3,4,5,6,7,8,9}
    local newitem2 = NativeUI.CreateSliderItem("Extra", extra2, 1, false)
    menu:AddItem(newitem)

    menu.OnSliderChange = function(sender, item, index)
        if item == newitem then
            quantity = item:IndexToItem(index)
            ShowNotification("Slider 1~r~" .. quantity)
        else
            quantity = item:IndexToItem(index)
            ShowNotification("Slider 2~r~" .. quantity)
        end
    end
end

Thanks for the reply, but unfortunately doing it this way both options are selected.

extra

Typoed. Sorry.

function AddMenuLivery(menu)
    local extra = { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20}
    local newitem = NativeUI.CreateListItem("Extra", extra, 1)
    menu:AddItem(newitem)

    local extra2 = {0,1,2,3,4,5,6,7,8,9}
    local newitem2 = NativeUI.CreateSliderItem("Extra", extra2, 1, false)
    menu:AddItem(newitem2)

    menu.OnSliderChange = function(sender, item, index)
        if item == newitem then
            quantity = item:IndexToItem(index)
            ShowNotification("Slider 1~r~" .. quantity)
        else
            quantity = item:IndexToItem(index)
            ShowNotification("Slider 2~r~" .. quantity)
        end
    end
end

I just figured this out :smiley: thank you anyway!

“Couldn’t load resource NativeUILua-2.1.0”. Didn’t add anything else but what came with the download.