Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

lua error attempt to index a nil value (local 'menu') can anyone help?

Asked by 2 years ago

there is a problem with the menu opening a player's info under player options.

ERROR: @warmenu/warmenu.lua:126: attempt to index a nil value (local 'menu') setMenuVisible (@warmenu/warmenu.lua:126)
(qb-adminmenu/client/main.lua:617)

local function setMenuVisible(id, visible, holdCurrentOption) if currentMenu then if visible then if currentMenu.id == id then return end else if currentMenu.id ~= id then return end end end

if visible then
    local menu = menus[id]

    if not currentMenu then
    --LINE 126  menu.currentOption = 1 

    else
        if not holdCurrentOption then
            menus[currentMenu.id].currentOption = 1
        end
    end

    currentMenu = menu
else
    currentMenu = nil
end

end

WARMENU LINE 445 setMenuVisible(id, true, true)

QB-ADMINMENU LINE 617 (first line) if WarMenu.MenuButton('#'..GetPlayerServerId(PlayerId()).." | "..GetPlayerName(PlayerId()), GetPlayerServerId(PlayerId())) then currentPlayer = GetPlayerServerId(PlayerId()) if WarMenu.CreateSubMenu('playerOptions', currentPlayer) then currentPlayerMenu = 'playerOptions' elseif WarMenu.CreateSubMenu('teleportOptions', currentPlayer) then currentPlayerMenu = 'teleportOptions' elseif WarMenu.CreateSubMenu('adminOptions', currentPlayer) then currentPlayerMenu = 'adminOptions' end

            if myPermissionRank == "god" then
                if WarMenu.CreateSubMenu('permissionOptions', currentPlayer) then
                    currentPlayerMenu = 'permissionOptions'
                end
            end
        end

can anyone help please

0
Could you please put all of the code in a lua block? This is not very readable. ColdFoxy07 76 — 2y

Answer this question