[ESX] & [QBCORE] Ownable vending machines

Showcase
OWNABLE VENDING MACHINES

Purchase
[ESX] - Vending machines | [QBCORE] - Vending machines

Features

  • Easy customization
  • Rent machine
  • Restock items
  • Change items prices
  • Withdraw money
  • Add days (rent)
  • 5 different machine types (you can add more or custom props)

Optimization
Full optimized.
0.00 ms

Code is accessible No
Subscription-based No
Lines (approximately) : ~550
Requirements [ESX] oxmysql (ox_lib, qtarget/ox_target, - optional, you can adapt to your own.)
Requirements [QB] oxmysql (qb-menu, qb-target, qb-input - optional, you can adapt to your own.)
Support Yes

Other Resources

Config


Config.Identifier = 1 -- 0 = steam identifier, 1 = license identifier(rockstar identifier)
Config.Target = "qb-target"
Config.KickReason = "[d3MBA-Vending machines] | Protection!"


Config.ProgressBar = { -- qb-progressbar or lj-progressbar
-- https://github.com/qbcore-framework/progressbar

    Loading = "Loading...",
}

Config.MachineObjects = { 
    ["sprunk"] = {
        `prop_vend_soda_02`,
        `v_68_broeknvend`,
    }, 
    ["cola"] = {
        `ch_chint10_vending_smallroom_01`,
        `prop_vend_fridge01`,
        `prop_vend_soda_01`,
    }, 
    ["water"] = {
        `prop_vend_water_01`,
    }, 
    ["candybox"] = {
        `prop_vend_snak_01`,
        `prop_vend_snak_01_tu`
    },
    ["coffee"] = {
        `prop_vend_coffe_01`,
    },

    ["allobjects"] = {
        `prop_vend_soda_02`,
        `v_68_broeknvend`,
        `prop_vend_water_01`,
        `prop_vend_soda_01`,
        `ch_chint10_vending_smallroom_01`,
        `prop_vend_fridge01`,
        `prop_vend_snak_01`,
        `prop_vend_snak_01_tu`,
        `prop_vend_coffe_01`,
    }
}
--------------------------- ACCOUNTS ---------------------------
Config.WithdrawAccount = "cash" -- QB("cash", "bank") --- ESX("money", "bank")
Config.BuyItemAccount = "cash" -- QB("cash", "bank") --- ESX("money", "bank")
Config.RentAccount = "cash" -- QB("cash", "bank") --- ESX("money", "bank")
----------------------------------------------------------------

Config.ExpireDelete = -3 -- 3 days after the rent is due before its deleted (default -3)

Config.RentDays = {7, 14, 28} -- https://imgur.com/aTRSjeR

Config.Restock = 0.8 -- the original price of item will multiply by 0.8 and that will be restock price, for e.g original price of coffee is 25$, restock price will be 20$ per one coffee.


Config.VendingMachines = { -- MachinePrice = Price per day (rent price)
                           -- You can add more items if you want

    ["coffee"] = {
        MachinePrice = 50, -- price per day 
        Prop = "prop_fib_coffee",

        Items = {
            ["coffee"] = {
                price = 4,
                stock = 0, 
            },  
        }
    },
    
    ["sprunk"] = {
        MachinePrice = 60, -- price per day 
        Prop = "prop_ld_can_01",

        Items = {
            ["kurkakola"] = {
                price = 5, 
                stock = 0
            },
        },
    },

    ["water"] = {
        MachinePrice = 40, -- price per day 
        Prop = "prop_ld_flow_bottle",

        Items = {
            ["water_bottle"] = {
                price = 5, 
                stock = 0
            },
        },
    },

    ["cola"] = {
        MachinePrice = 60, -- price per day 
        Prop = "prop_ecola_can",

        Items = {
            ["kurkakola"] = {
                price = 5, 
                stock = 0
            },
        },
    },

    ["candybox"] = {
        MachinePrice = 75, -- price per day 
        Prop = "prop_candy_pqs",

        Items = {
            ["twerks_candy"] = {
                price = 5, 
                stock = 0
            },

            ["snikkel_candy"] = {
                price = 7, 
                stock = 0
            },

        },
    },
}


Config.Notifications = {

    Settings = {
        Info = "primary", 
        Error = "error", 
        Success = "success",    
    },

    ["bought"] = "Bought for %s$.", -- %s is variable for item price 
    ["vending_machine_rented"] = "The vending machine (%s) was successfully rented for %s days - %s$", -- %s is variable for item price 
    ["added_days"] = "Added %s days.", -- %s is variable for item price 
    ["no_enough_money"] = "You don't have enough money - %s$",
    ["restocked"] = "Restocked - %s",
    ["update_price"] = "Price of %s is updated to ",
    ["withdraw_money"] = "+ %s$",
    ["out_of_stock"] = "This item is out of stock!",

    -- This notification will show up when the vending machine is moved from the original coords, in that case, script cannot identify the machine and this notification will show up.
    ["block_using_machine"] = "You can't use this vending machine at the moment!",
}


Config.TargetLabels = {
    ["vending_machine"] = "Vending machine"

}

Config.TargetIcons = {
    ["circle"] = "fas fa-circle",
}

3 Likes

looks nice, think i will try :slight_smile:

1 Like

Thanks! :grinning:

interesting idea!

1 Like

this looks rly nice :wink:

1 Like

Is that work with NativeUI?