You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is what the script has but the menu of the Cocktail is not working what is wrong and i litterly out off focus how to fix it, can someone help me. it gives the next script error.
SCRIPT ERROR: @jim-vanillaunicorn/client/lua:500: attempt to index a nil value (field '?')
i feel there is something missing but don't know what.
RegisterNetEvent('jim-vanillaunicorn:Crafting', function(data)
if not jobCheck() then return end
local Menu = {}
if Config.Menu == "qb" then
Menu[#Menu + 1] = { header = data.header, txt = "", isMenuHeader = true }
Menu[#Menu + 1] = { icon = "fas fa-circle-xmark", header = "", txt = Loc[Config.Lan].menu["close"], params = { event = "" } }
end
for i = 1, #data.craftable do
for k, v in pairs(data.craftable[i]) do
if k ~= "amount" then
local text = ""
setheader = QBCore.Shared.Items[tostring(k)].label
if data.craftable[i]["amount"] ~= nil then setheader = setheader.." x"..data.craftable[i]["amount"] end
local disable = false
local checktable = {}
for l, b in pairs(data.craftable[i][tostring(k)]) do
if b == 1 then number = "" else number = " x"..b end
if not QBCore.Shared.Items[l] then print("^3Error^7: ^2Script can't find ingredient item in QB-Core items.lua - ^1"..l.."^7") return end
if Config.Menu == "ox" then text = text..QBCore.Shared.Items[l].label..number.."\n" end
if Config.Menu == "qb" then text = text.."- "..QBCore.Shared.Items[l].label..number.." " end
settext = text
checktable[l] = HasItem(l, b)
end
for _, v in pairs(checktable) do if v == false then disable = true break end end
if not disable then setheader = setheader.." ✔️" end
Menu[#Menu + 1] = {
disabled = disable,
image = "nui://"..Config.img..QBCore.Shared.Items[tostring(k)].image,
icon = "nui://"..Config.img..QBCore.Shared.Items[tostring(k)].image,
header = setheader, txt = settext, --qb-menu
title = setheader, description = settext, -- ox_lib
event = "jim-vanillaunicorn:Crafting:MakeItem", -- ox_lib
args = { item = k, craft = data.craftable[i], craftable = data.craftable, header = data.header }, -- ox_lib
params = { event = "jim-vanillaunicorn:Crafting:MakeItem", args = { item = k, craft = data.craftable[i], craftable = data.craftable, header = data.header } } -- qb-menu
}
settext, setheader = nil
end
end
end
if Config.Menu == "ox" then
exports.ox_lib:registerContext({id = 'Crafting', title = data.header, position = 'top-right', options = Menu })
exports.ox_lib:showContext("Crafting")
elseif Config.Menu == "qb" then
exports['qb-menu']:openMenu(Menu)
end
lookEnt(data.coords)
end)
The text was updated successfully, but these errors were encountered:
This is what the script has but the menu of the Cocktail is not working what is wrong and i litterly out off focus how to fix it, can someone help me. it gives the next script error.
SCRIPT ERROR: @jim-vanillaunicorn/client/lua:500: attempt to index a nil value (field '?')
i feel there is something missing but don't know what.
RegisterNetEvent('jim-vanillaunicorn:Crafting', function(data)
if not jobCheck() then return end
local Menu = {}
if Config.Menu == "qb" then
Menu[#Menu + 1] = { header = data.header, txt = "", isMenuHeader = true }
Menu[#Menu + 1] = { icon = "fas fa-circle-xmark", header = "", txt = Loc[Config.Lan].menu["close"], params = { event = "" } }
end
for i = 1, #data.craftable do
for k, v in pairs(data.craftable[i]) do
if k ~= "amount" then
local text = ""
setheader = QBCore.Shared.Items[tostring(k)].label
if data.craftable[i]["amount"] ~= nil then setheader = setheader.." x"..data.craftable[i]["amount"] end
local disable = false
local checktable = {}
for l, b in pairs(data.craftable[i][tostring(k)]) do
if b == 1 then number = "" else number = " x"..b end
if not QBCore.Shared.Items[l] then print("^3Error^7: ^2Script can't find ingredient item in QB-Core items.lua - ^1"..l.."^7") return end
if Config.Menu == "ox" then text = text..QBCore.Shared.Items[l].label..number.."\n" end
if Config.Menu == "qb" then text = text.."- "..QBCore.Shared.Items[l].label..number.."
" end
settext = text
checktable[l] = HasItem(l, b)
end
for _, v in pairs(checktable) do if v == false then disable = true break end end
if not disable then setheader = setheader.." ✔️" end
Menu[#Menu + 1] = {
disabled = disable,
image = "nui://"..Config.img..QBCore.Shared.Items[tostring(k)].image,
icon = "nui://"..Config.img..QBCore.Shared.Items[tostring(k)].image,
header = setheader, txt = settext, --qb-menu
title = setheader, description = settext, -- ox_lib
event = "jim-vanillaunicorn:Crafting:MakeItem", -- ox_lib
args = { item = k, craft = data.craftable[i], craftable = data.craftable, header = data.header }, -- ox_lib
params = { event = "jim-vanillaunicorn:Crafting:MakeItem", args = { item = k, craft = data.craftable[i], craftable = data.craftable, header = data.header } } -- qb-menu
}
settext, setheader = nil
end
end
end
if Config.Menu == "ox" then
exports.ox_lib:registerContext({id = 'Crafting', title = data.header, position = 'top-right', options = Menu })
exports.ox_lib:showContext("Crafting")
elseif Config.Menu == "qb" then
exports['qb-menu']:openMenu(Menu)
end
lookEnt(data.coords)
end)
The text was updated successfully, but these errors were encountered: