Error doing NUI callback menu_submit

2 Beiträge · 4.408 Aufrufe
05.01.2020, 23:44 #1

Folgendes Problem, ich versuche ein Menü zu öffnen mit folgendem Code:

function openStartMenu()
    local elements = {}
    local vehiclePropsList = {}

    ESX.TriggerServerCallback('auktionshaus_auktionsAutos:cb:getCars', function(vehicles)
        if not table.empty(vehicles) then
            for k,v in ipairs(vehicles) do
                local vehicleProps = json.decode(v.vehicle)
                vehiclePropsList[vehicleProps.plate] = vehicleProps
                local vehicleHash = vehicleProps.model
                local vehicleName
                vehicleName = GetDisplayNameFromVehicleModel(vehicleHash)
                table.insert(elements, {label = vehicleName, plate = vehicleProps.plate, props = vehicleProps})
            end
        else
            table.insert(elements, {label = "You don't own any vehicle."})
        end
    end)

    Citizen.Wait(500)
    
    ESX.UI.Open(
        'default', GetCurrentResourceName(), 'auktionshaus_auktionsAutos',
        {
          title    = 'Fahrzeug auswählen',
          align    = 'top-left',
          elements = elements
        },

        function(data, menu)
            local vehiclePropsList = vehiclePropsList[data.current.plate]
            if data.current.plate ~= nil then
                ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'getName', {
                    title = 'Auktionstitel'
                }, function(data2, menu2)
                    local nome = data2.value
                    if nome ~= nil then
                        menu2.close()
                        ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'Startpreis', {
                            title = 'Startpreis'
                        }, function(dataa, menuu)
                            local preco = dataa.value
                            if tonumber(preco) ~= nil then 
                                menuu.close()
                                ESX.UI.Menu.CloseAll()
                                cometoauction(data.current.label, data.current.plate, nome, preco, data.current.props)
                            end
                        end, function(dataa, menuu)
                            menuu.close()
                        end)
                    else
                        --print('nao pode estar vazio')
                    end
                end, function(data2, menu2)
                    menu2.close()
                end)
            end
        end,

          function(data, menu)
            menu.close()
          end
    )
end

Leider nicht sehr erfolgreich, mit ähnlichem Code, welchen ich ganz unten einfügen werde, funktioniert das jedoch einwandfrei.

Eine direkte Referenz wo im Code der Fehler liegen könnte, gibt das ganze nicht, es verweist auf esx_menu mit dem NUI callback menu_submit.


Versuche seit geraumer Zeit das ganze erfolglos zu beheben, deswegen bin ich für jede Hilfe sehr froh ^^


Hier der andere Code:


function abrirmenucomecar() -- openStartMenu
    local elements = {}
    local vehiclePropsList = {}

    ESX.TriggerServerCallback('matif_leilaocarros:cb:getcarros', function(vehicles)
        if not table.empty(vehicles) then
            for k,v in ipairs(vehicles) do
                local vehicleProps = json.decode(v.vehicle)
                vehiclePropsList[vehicleProps.plate] = vehicleProps
                local vehicleHash = vehicleProps.model
                local vehicleName
                vehicleName = GetDisplayNameFromVehicleModel(vehicleHash)
                table.insert(elements, {label = vehicleName, plate = vehicleProps.plate, props = vehicleProps})
            end
        else
            table.insert(elements, {label = "You don't own any vehicle."})
        end
    end)

    Citizen.Wait(500)

    ESX.UI.Menu.Open(

        'default', GetCurrentResourceName(), 'matif_leilaocarros',
        {
          title    = 'Fahrzeug auswählen',
          align    = 'top-left',
          elements = elements
        },

        function(data, menu)
            local vehicleProps = vehiclePropsList[data.current.plate]
            if data.current.plate ~= nil then
                ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'escolhernome', {
                    title = 'Auktionstitel'
                }, function(data2, menu2)
                    local nome = data2.value
                    if nome ~= nil then
                        menu2.close()
                        ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'precoinical', {
                            title = 'Starting bid'
                        }, function(dataa, menuu)
                            local preco = dataa.value
                            if tonumber(preco) ~= nil then
                                menuu.close()
                                ESX.UI.Menu.CloseAll()
                                comecarleilaoo(data.current.label, data.current.plate, nome, preco, data.current.props)
                            end
                        end, function(dataa, menuu)
                            menuu.close()
                        end)
                    else
                        --print('nao pode estar vazio')
                    end
                end, function(data2, menu2)
                    menu2.close()
                end)
            end
        end,

          function(data, menu)
            menu.close()
          end
    )

end
06.01.2020, 01:42 #2

Problem gelöst, hatte wohl oben ESX.UI.MENU.Open falsch gehabt

Melde dich an, um zu antworten.
© 2026 GTA-FIVEM.ORGImpressumDatenschutzNutzungsbedingungenCookiesShimo Forum