Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vanilla Unicron Cocktail menu #25

Open
Bimmalord opened this issue Jul 9, 2023 · 0 comments
Open

Vanilla Unicron Cocktail menu #25

Bimmalord opened this issue Jul 9, 2023 · 0 comments

Comments

@Bimmalord
Copy link

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 '?')

handler (@jim-vanillaunicorn/client/client.lua:500)
fn (qb-target/client:1168)

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant