Installation
Install the distillery packages and connect their database, inventory and framework functions.
Required dependencies
Database connector used by the resource.
Default inventory integration; replaceable in the open-source functions.
Required for Lua 5.4 and escrow support.
Required for server-side teleporting and distance handling.
Object and shared utility integration.
Open resource ↗Installation steps
- 01
Install the Aquiver API
Install and start aquiver_lua before the distillery resources.
- 02
Extract both packages
Copy the prop and main script resources into your server resources directory.
- 03
Import the database
Import the SQL file included with avp_distillery.
- 04
Configure the economy
Adjust prices and economy settings for your server.
config.lua - 05
Configure framework functions
Connect the external functions to your framework.
_external.lua - 06
Configure locales
Create or modify the Lua translation files.
locales/*.lua - 07
Register inventory items
Register the included items and images in ox_inventory.
- 08
Start the resources
Start the props before the main distillery resource.
Inventory integration
warning
Add the images to both the ox_inventory folder and avp_distillery.
ox_inventory/web/images/Add the inventory item images here.
avp_distillery/html/vue-src/src/assets/imgAdd the same images to the Distillery interface.
Register ox_inventory items
Add the Distillery items to the ox_inventory item configuration.
['avp_bucket'] = {
label = 'Bucket',
weight = 1,
stack = false,
close = true,
description = nil,
consume = 1,
server = {
export = 'avp_distillery.avp_bucket'
},
},
['avp_plum'] = {
label = 'Plum',
weight = 1,
stack = true,
description = nil,
consume = 0
},
['avp_peach'] = {
label = 'Peach',
weight = 1,
stack = true,
description = nil,
consume = 0
},
['avp_cherry'] = {
label = 'Cherry',
weight = 1,
stack = true,
description = nil,
consume = 0
},
['avp_pear'] = {
label = 'Pear',
weight = 1,
stack = true,
description = nil,
consume = 0
},
['avp_bottle'] = {
label = 'Empty bottle',
weight = 1,
stack = true,
description = nil,
consume = 0
}
Framework functions
_external.lua
Connect the Distillery player, inventory, banking and permission functions to ESX.
local ESX = exports.es_extended:getSharedObject()
ServerExternals = {
player_addItem = function(source, item, amount)
if exports.ox_inventory:CanCarryItem(source, item, amount) then
exports.ox_inventory:AddItem(source, item, amount)
end
end,
player_getItemAmount = function(source, item)
return exports.ox_inventory:GetItem(source, item, nil, true)
end,
player_removeItem = function(source, item, amount)
exports.ox_inventory:RemoveItem(source, item, amount)
end,
player_addBank = function(source, amount)
local xPlayer = ESX.GetPlayerFromId(source)
if xPlayer then
xPlayer.addAccountMoney("bank", amount)
end
end,
player_removeBank = function(source, amount)
local xPlayer = ESX.GetPlayerFromId(source)
if xPlayer then
xPlayer.removeAccountMoney("bank", amount)
end
end,
player_getBank = function(source)
local amount = 0
local xPlayer = ESX.GetPlayerFromId(source)
if xPlayer then
local account = xPlayer.getAccount("bank")
if account then
amount = account.money
end
end
return amount
end,
player_hasPermission = function(source)
local xPlayer = ESX.GetPlayerFromId(source)
if xPlayer then
return xPlayer.getGroup() == "admin"
end
-- local ip = nil
-- for _, id in pairs(GetPlayerIdentifiers(source)) do
-- if string.match(id, "ip:") then
-- ip = string.sub(id, 4)
-- end
-- end
-- return string.match(ip or "", "192.168.0") and true or false
end,
player_getName = function(source)
local name = GetPlayerName(source)
local xPlayer = ESX.GetPlayerFromId(source)
if xPlayer then
name = xPlayer.getName()
end
return name
end,
player_getIdentifier = function(source)
local xPlayer = ESX.GetPlayerFromId(source)
if xPlayer then
return xPlayer.getIdentifier()
end
end
}