Newer
Older
TFC-BurgerShot / client / drinks.lua
local QBCore = exports['qb-core']:GetCoreObject()
lib.registerContext({
    id = 'bs_drinks',
    title = 'Drinks',
    options = {
        {
            title = 'eCola',
            description = '$50',
            event = 'tfc-bs-job:client:drinkmenu',
            arrow = true,
            args = {
                item = "ecola",
                label = "eCola",
                price = 50,
            }
        },
        {
            title = 'eCola Light',
            description = '$50',
            event = 'tfc-bs-job:client:drinkmenu',
            arrow = true,
            args = {
                item = "ecolalight",
                label = "eCola Light",
                price = 50,
            }
        },
        {
            title = 'Sprunk',
            description = '$50',
            event = 'tfc-bs-job:client:drinkmenu',
            arrow = true,
            args = {
                item = "sprunk",
                label = "Sprunk",
                price = 50,
            }
        },
        {
            title = 'Sprunk Light',
            description = '$50',
            event = 'tfc-bs-job:client:drinkmenu',
            arrow = true,
            args = {
                item = "sprunklight",
                label = "Sprunk Light",
                price = 50,
            }
        },
    },
})
RegisterNetEvent('tfc-bs-job:client:drinkmenu', function(args)
    lib.registerContext({
        id = 'bs_drinkpayment',
        title = 'Payment for '..args.label,
        options = {
            {
            title = 'You Owe $'..args.price,
            readOnly = true
            },
            {
            title = 'Cash',
            serverEvent = 'tfc-bs-job:server:buy',
            args = {
                item = args.item,
                price = args.price,
                label = args.label,
                payment = "cash"
                }
            },
            {
            title = 'Bank',
            serverEvent = 'tfc-bs-job:server:buy',
            args = {
                item = args.item,
                price = args.price,
                label = args.label,
                payment = "bank"
                }
            },
            {
                title = 'Back',
                icon = 'fas fa-backward',
                menu = 'bs_shop',
                arrow = false
              }
        }
    })
    lib.showContext('bs_drinkpayment')
end)

RegisterNetEvent('tfc-bs-job:client:drinkfinished', function()
    QBCore.Functions.Notify('Purchase Successful', 'success')
    lib.showContext('bs_shop')
end)

RegisterNetEvent('tfc-bs-job:client:drinkfailed', function()
    QBCore.Functions.Notify('You need more money', 'error', 5000)
end)