🥪Food & Drink Props
Installation:
Download the resource from CFX Portal: https://portal.cfx.re/assets/granted-assets?page=1&sort=asset.updated_at&direction=asc
Unzip and drag the 'dc_foodanddrinks' folder into your server resources folder and make sure it's ensured on server.cfg
Check the 'install' folder in the main folder of the props, and install whatever version of the items your server uses. For ox_inventory, use the items oxdefault.lua if you are going to be using another script like devcore needs to handle the item usage and props for example. Use oxfullitems.lua if you want ox_inventory to handle all the items with props, animations etc.
Make sure to copy the images from the 'images' folder into your inventory images folder.
For qb-smallresources:
If you want to use the props with qb-smallresources there is an extra step you need to take.
Make sure you have copied the items from the 'qbcore.lua' in the 'install' folder of the props to your actual qbcore items.lua.
Go to qb-smallresources and open the config.lua. Find the Config.Consumables section and look for the 'custom' table:
Copy & Paste everything from the 'smallresources.lua' in the props folder into that custom section. Make any adjustments you want such as the time, label etc.
Go to the 'client' folder of qb-smallresources & open the consumables.lua file. Search for this Event:
RegisterNetEvent('consumables:client:Custom', function(itemName)Replace that entire event with the one below:RegisterNetEvent('consumables:client:Custom', function(itemName) QBCore.Functions.TriggerCallback('consumables:itemdata', function(data) local propsList = {} if data.prop then if type(data.prop) == 'table' and data.prop[1] then propsList = data.prop elseif type(data.prop) == 'table' and data.prop.model then propsList = { data.prop } end end local attachedProps = {} local function spawnProps() local ped = PlayerPedId() for _, propData in ipairs(propsList) do local model = type(propData.model) == 'number' and propData.model or GetHashKey(propData.model) if not HasModelLoaded(model) then RequestModel(model) while not HasModelLoaded(model) do Wait(0) end end local obj = CreateObject(model, 0.0, 0.0, 0.0, true, true, false) local boneIndex = GetPedBoneIndex(ped, propData.bone or 60309) local ox, oy, oz = 0.0, 0.0, 0.0 if propData.coords then ox, oy, oz = propData.coords.x, propData.coords.y, propData.coords.z end local rx, ry, rz = 0.0, 0.0, 0.0 if propData.rotation then rx, ry, rz = propData.rotation.x, propData.rotation.y, propData.rotation.z end AttachEntityToEntity(obj, ped, boneIndex, ox, oy, oz, rx, ry, rz, true, true, false, true, 1, true) table.insert(attachedProps, obj) end end local function cleanupProps() for _, obj in ipairs(attachedProps) do if DoesEntityExist(obj) then DeleteEntity(obj) end end attachedProps = {} end spawnProps() QBCore.Functions.Progressbar('custom_consumable', data.progress.label, data.progress.time, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, disableCombat = true }, { animDict = data.animation.animDict, anim = data.animation.anim, flags = data.animation.flags }, {}, {}, function() cleanupProps() ClearPedTasks(PlayerPedId()) TriggerEvent('qb-inventory:client:ItemBox', QBCore.Shared.Items[itemName], 'remove') if data.replenish.type then TriggerServerEvent('consumables:server:add' .. data.replenish.type, QBCore.Functions.GetPlayerData().metadata[string.lower(data.replenish.type)] + data.replenish.replenish) end if data.replenish.isAlcohol then alcoholCount += 1 AlcoholLoop() if alcoholCount > 1 and alcoholCount < 4 then TriggerEvent('evidence:client:SetStatus', 'alcohol', 200) elseif alcoholCount >= 4 then TriggerEvent('evidence:client:SetStatus', 'heavyalcohol', 200) end end if data.replenish.event then TriggerEvent(data.replenish.event) end end, function() cleanupProps() QBCore.Functions.Notify(Lang:t('consumables.canceled'), 'error') end) end, itemName) end)
Last updated