Installation
Installing & dependencies.
Dependencies
- oxmysql
- ox-inventory (or you can modify the functions, in the open source one)
- Server version atleast 4752. (to support lua54 & escrow)
- OneSync ON (For serverside player teleporting/distancing, etc. You can easily make the script to non onesync if you sync the player-position to server, etc.)
- Aquiver api (lua) (CLICK HERE)
Install
warning
Do not forget to install the aquiver_lua before installing this script. We use that API to create objects and handle many things.
- Download the "avp_distillery_props" and "avp_distillery" package and put it into your resources folder.
- Import the .sql file from the "avp_distillery" into your SQL database.
- Edit the config.lua file to adjust the economy to your server.
- Modify the _external.lua file, to add your framework functions. (more help below)
- Create or modify the locale files in the locales/*.lua folder.
- Register the items in the ox-inventory. (more instructions below)
- Start?
ox_inventory item register
warning
Do not forget to add the images both in the ox-inventory folder and both in the avp_distillery.
ox_inventory image folder
ox_inventory/web/images/
distillery image folder
avp_distillery/html/vue-src/src/assets/img
ox_inventory/data/items.lua
['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
}
_external.lua file
Default for 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
}