uj-qbfood-main

uj-qbfood

QBcore Food Addon Script

Welcome to the QBcore Food Addon Script! This script adds a variety of food-related features to your QBcore FiveM server, enhancing the roleplaying experience for your players. From hunger mechanics to restaurants and food items, this addon provides a comprehensive system for managing food in your server.

Features

  • Food Items: A wide range of food items are available for purchase or consumption, including snacks, meals, and drinks.

  • Inventory Integration: Seamlessly integrates with QBcore's inventory system, allowing players to store and manage their food items.

Installation

  1. Ensure you have a working installation of QBcore.

  2. Go to your qb-core/shared/item.lua and append the contents of items.lua.md at the bottom.

Add to shared.lua example

QBShared = QBShared or {}
QBShared.Items = {
    -- Other Tools
    -- [Previous items]
    ---add you food items below here 
    ['atom_junkie'] = {['name'] = 'atom_junkie', ['label'] = 'Atom Junkie', ['weight'] = 100, ["decay"] = nil, ['type'] = 'item', ['image'] = 'atom_junkie.png', ["created"] = nil, ["delete"] = true, ['unique'] = false, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil,   ['description'] = ''},
    ---add more food items here
}
  1. Go to your qb-smallresources/server/consumables.lua and append the contents of consumables.md.

Add to consumables.lua example

local QBCore = exports['qb-core']:GetCoreObject()
-- [Other consumable functions]
---Add your Food Items Below here
QBCore.Functions.CreateUseableItem("atom_junkie", function(source, item)
    local Player = QBCore.Functions.GetPlayer(source)
    if Player.Functions.RemoveItem(item.name, 1, item.slot) then
        TriggerClientEvent("consumables:client:Eat", source, item.name)
    end
end)

---Add More Food items here
  1. Go to your qb-smallresources/config.lua and append the contents of consumables.md under Config.Consumables =.

Add to config.lua example

Config.Consumables = {
    eat = { 
        -- default food items
        ['sandwich'] = math.random(35, 54),
        ['tosti'] = math.random(40, 50),
        -- [other food items]
        --uj-qbfood
        ["atom_junkie"] = math.random(35, 54),
        ---add the rest here 
    },
}
  1. Add all the images in pic to your inventory/html/images.

Contributing

If you'd like to contribute to the development of this script, feel free to fork the repository and submit a pull request with your changes. Bug fixes, feature enhancements, and documentation improvements are all welcome!

License

This project is licensed under the MIT License - see the LICENSE file for details.

Last updated