Configuration
shared.lua (client and server side)
The configuration file (config/shared.lua
) contains various settings that can be adjusted to customize the script's behavior. Below are some of the key configuration options:
Framework
: Set to either "esx" or "qb" depending on the framework you are using.ESXExport
: If using a recent version of ESX, set the script name. Default is "es_extended".Core
: Default ESX: "esx:getSharedObject" | Default QB: "qb-core".Mysql
: Set to "oxmysql", "mysql-async", or "ghmattisql" depending on the MySQL plugin you are using.propsRadius
: Radius in which the props will be spawned.hideProp
: Set to true if you want the prop to be hidden after harvesting.debug
: Set to true to print debug messages in the console.adminGroup
: Admin group to access the admin panel.command
: Command to open the admin panel.cooldown
: Set a cooldown in milliseconds to harvest the same prop.
Config, Noti, Lang = {}, {}, {}
-- $$$$$$\ $$$$$$\ $$\ $$\ $$$$$$$$\ $$$$$$\ $$$$$$\ $$\ $$\ $$$$$$$\ $$$$$$\ $$$$$$$$\ $$$$$$\ $$$$$$\ $$\ $$\
-- $$ __$$\ $$ __$$\ $$$\ $$ |$$ _____|\_$$ _|$$ __$$\ $$ | $$ |$$ __$$\ $$ __$$\\__$$ __|\_$$ _|$$ __$$\ $$$\ $$ |
-- $$ / \__|$$ / $$ |$$$$\ $$ |$$ | $$ | $$ / \__|$$ | $$ |$$ | $$ |$$ / $$ | $$ | $$ | $$ / $$ |$$$$\ $$ |
-- $$ | $$ | $$ |$$ $$\$$ |$$$$$\ $$ | $$ |$$$$\ $$ | $$ |$$$$$$$ |$$$$$$$$ | $$ | $$ | $$ | $$ |$$ $$\$$ |
-- $$ | $$ | $$ |$$ \$$$$ |$$ __| $$ | $$ |\_$$ |$$ | $$ |$$ __$$< $$ __$$ | $$ | $$ | $$ | $$ |$$ \$$$$ |
-- $$ | $$\ $$ | $$ |$$ |\$$$ |$$ | $$ | $$ | $$ |$$ | $$ |$$ | $$ |$$ | $$ | $$ | $$ | $$ | $$ |$$ |\$$$ |
-- \$$$$$$ | $$$$$$ |$$ | \$$ |$$ | $$$$$$\ \$$$$$$ |\$$$$$$ |$$ | $$ |$$ | $$ | $$ | $$$$$$\ $$$$$$ |$$ | \$$ |
-- \______/ \______/ \__| \__|\__| \______| \______/ \______/ \__| \__|\__| \__| \__| \______| \______/ \__| \__|
-- Use "esx" or "qb"
Config.Framework = "qb"
-- If you are using one of the most recent versions of ESX, set the script name. Default = "es_extended"
Config.ESXExport = "es_extended"
-- Default ESX: "esx:getSharedObject" | Default QB: "qb-core"
Config.Core = "qb-core"
-- oxmysql, mysql-async or ghmattisql
Config.Mysql = "oxmysql"
-- Radius in which the props will be spawned
Config.propsRadius = 20
-- Set to true if you want the prop to be hidden after harvesting
Config.hideProp = true
-- Set to true print debug messages in the console
Config.debug = false
-- Admin group to access the admin panel
Config.adminGroup = "admin"
-- Command to open the admin panel
Config.command = "drugscreator"
-- Set a cooldown in milisenconds to harvest the same prop
Config.cooldown = 20000
-- $$\ $$\ $$$$$$\ $$$$$$$$\ $$$$$$\ $$$$$$$$\ $$$$$$\ $$$$$$\ $$$$$$\ $$$$$$$$\ $$$$$$\ $$$$$$\ $$\ $$\ $$$$$$\
-- $$$\ $$ |$$ __$$\\__$$ __|\_$$ _|$$ _____|\_$$ _|$$ __$$\ $$ __$$\\__$$ __|\_$$ _|$$ __$$\ $$$\ $$ |$$ __$$\
-- $$$$\ $$ |$$ / $$ | $$ | $$ | $$ | $$ | $$ / \__|$$ / $$ | $$ | $$ | $$ / $$ |$$$$\ $$ |$$ / \__|
-- $$ $$\$$ |$$ | $$ | $$ | $$ | $$$$$\ $$ | $$ | $$$$$$$$ | $$ | $$ | $$ | $$ |$$ $$\$$ |\$$$$$$\
-- $$ \$$$$ |$$ | $$ | $$ | $$ | $$ __| $$ | $$ | $$ __$$ | $$ | $$ | $$ | $$ |$$ \$$$$ | \____$$\
-- $$ |\$$$ |$$ | $$ | $$ | $$ | $$ | $$ | $$ | $$\ $$ | $$ | $$ | $$ | $$ | $$ |$$ |\$$$ |$$\ $$ |
-- $$ | \$$ | $$$$$$ | $$ | $$$$$$\ $$ | $$$$$$\ \$$$$$$ |$$ | $$ | $$ | $$$$$$\ $$$$$$ |$$ | \$$ |\$$$$$$ |
-- \__| \__| \______/ \__| \______|\__| \______| \______/ \__| \__| \__| \______| \______/ \__| \__| \______/
function notifications(notitype, message, time)
-- Change this trigger for your notification system keeping the variables
TriggerEvent("codem-notification", message, time, notitype)
end
-- Notifications types:
Noti.info = "info"
Noti.check = "check"
Noti.error = "error"
-- Notification time:
Noti.time = 5000
-- $$$$$$$$\ $$$$$$\ $$$$$$$\ $$$$$$\ $$$$$$$$\ $$$$$$$$\
-- \__$$ __|$$ __$$\ $$ __$$\ $$ __$$\ $$ _____|\__$$ __|
-- $$ | $$ / $$ |$$ | $$ |$$ / \__|$$ | $$ |
-- $$ | $$$$$$$$ |$$$$$$$ |$$ |$$$$\ $$$$$\ $$ |
-- $$ | $$ __$$ |$$ __$$< $$ |\_$$ |$$ __| $$ |
-- $$ | $$ | $$ |$$ | $$ |$$ | $$ |$$ | $$ |
-- $$ | $$ | $$ |$$ | $$ |\$$$$$$ |$$$$$$$$\ $$ |
-- \__| \__| \__|\__| \__| \______/ \________| \__|
Config.useTarget = true
-- Function for the use of the target in entities (e.g., the npc delivering the job).
function entityTarget(entity, event, label, drug, processType)
local selector = nil
if processType == "craft" then
selector = "craft"
else
selector = "process"
end
exports["qb-target"]:AddTargetEntity(
entity,
{
options = {
{
type = "client",
event = event,
icon = "fas fa-box-circle-check",
label = label,
args = {
drug = drug,
process = selector
}
}
},
distance = 3.0
}
)
end
-- $$\ $$$$$$\ $$\ $$\ $$$$$$\ $$\ $$\ $$$$$$\ $$$$$$\ $$$$$$$$\
-- $$ | $$ __$$\ $$$\ $$ |$$ __$$\ $$ | $$ |$$ __$$\ $$ __$$\ $$ _____|
-- $$ | $$ / $$ |$$$$\ $$ |$$ / \__|$$ | $$ |$$ / $$ |$$ / \__|$$ |
-- $$ | $$$$$$$$ |$$ $$\$$ |$$ |$$$$\ $$ | $$ |$$$$$$$$ |$$ |$$$$\ $$$$$\
-- $$ | $$ __$$ |$$ \$$$$ |$$ |\_$$ |$$ | $$ |$$ __$$ |$$ |\_$$ |$$ __|
-- $$ | $$ | $$ |$$ |\$$$ |$$ | $$ |$$ | $$ |$$ | $$ |$$ | $$ |$$ |
-- $$$$$$$$\ $$ | $$ |$$ | \$$ |\$$$$$$ |\$$$$$$ |$$ | $$ |\$$$$$$ |$$$$$$$$\
-- \________|\__| \__|\__| \__| \______/ \______/ \__| \__| \______/ \________|
Lang.alreadyExist = "There is already a drug by that name"
Lang.created = "The drug has been created correctly"
Lang.edited = "The drug has been edited successfully"
Lang.deleted = "The drug has been deleted"
Lang.collect = "Press ~g~[E]~w~ to collect"
Lang.collectTarget = "Collect"
Lang.collecting = "Collecting..."
Lang.cancelled = "The process has been cancelled"
Lang.craft = "Press ~g~[E]~w~ to craft"
Lang.craftTarget = "Craft"
Lang.notEnoughIngredients = "You don't have enough ingredients"
Lang.imported = "The drug has been imported successfully"
Lang.cooldown = "You must wait a few seconds to use this again"
-- $$$$$$$\ $$$$$$$\ $$$$$$\ $$\ $$\ $$$$$$$$\ $$$$$$$$\ $$\ $$\ $$$$$$$$\
-- $$ __$$\ $$ __$$\ $$ __$$\ $$ | $\ $$ | \__$$ __|$$ _____|$$ | $$ |\__$$ __|
-- $$ | $$ |$$ | $$ |$$ / $$ |$$ |$$$\ $$ | $$ | $$ | \$$\ $$ | $$ |
-- $$ | $$ |$$$$$$$ |$$$$$$$$ |$$ $$ $$\$$ | $$ | $$$$$\ \$$$$ / $$ |
-- $$ | $$ |$$ __$$< $$ __$$ |$$$$ _$$$$ | $$ | $$ __| $$ $$< $$ |
-- $$ | $$ |$$ | $$ |$$ | $$ |$$$ / \$$$ | $$ | $$ | $$ /\$$\ $$ |
-- $$$$$$$ |$$ | $$ |$$ | $$ |$$ / \$$ | $$ | $$$$$$$$\ $$ / $$ | $$ |
-- \_______/ \__| \__|\__| \__|\__/ \__| \__| \________|\__| \__| \__|
function Draw3DText(x, y, z, textInput, fontId, scaleX, scaleY)
local px, py, pz = table.unpack(GetGameplayCamCoords())
local dist = GetDistanceBetweenCoords(px, py, pz, x, y, z, 1)
local scale = (1 / dist) * 20
local fov = (1 / GetGameplayCamFov()) * 100
local scale = scale * fov
SetTextScale(scaleX * scale, scaleY * scale)
SetTextFont(fontId)
SetTextProportional(1)
SetTextColour(250, 250, 250, 255) -- You can change the text color here
SetTextDropshadow(1, 1, 1, 1, 255)
SetTextEdge(2, 0, 0, 0, 150)
SetTextDropShadow()
SetTextOutline()
SetTextEntry("STRING")
SetTextCentre(1)
AddTextComponentString(textInput)
SetDrawOrigin(x, y, z + 2, 0)
DrawText(0.0, 0.0)
ClearDrawOrigin()
end
-- $$$$$$$\ $$$$$$$\ $$$$$$\ $$$$$$\ $$$$$$$\ $$$$$$$$\ $$$$$$\ $$$$$$\ $$$$$$$\ $$$$$$\ $$$$$$$\
-- $$ __$$\ $$ __$$\ $$ __$$\ $$ __$$\ $$ __$$\ $$ _____|$$ __$$\ $$ __$$\ $$ __$$\ $$ __$$\ $$ __$$\
-- $$ | $$ |$$ | $$ |$$ / $$ |$$ / \__|$$ | $$ |$$ | $$ / \__|$$ / \__| $$ | $$ |$$ / $$ |$$ | $$ |
-- $$$$$$$ |$$$$$$$ |$$ | $$ |$$ |$$$$\ $$$$$$$ |$$$$$\ \$$$$$$\ \$$$$$$\ $$$$$$$\ |$$$$$$$$ |$$$$$$$ |
-- $$ ____/ $$ __$$< $$ | $$ |$$ |\_$$ |$$ __$$< $$ __| \____$$\ \____$$\ $$ __$$\ $$ __$$ |$$ __$$<
-- $$ | $$ | $$ |$$ | $$ |$$ | $$ |$$ | $$ |$$ | $$\ $$ |$$\ $$ | $$ | $$ |$$ | $$ |$$ | $$ |
-- $$ | $$ | $$ | $$$$$$ |\$$$$$$ |$$ | $$ |$$$$$$$$\ \$$$$$$ |\$$$$$$ | $$$$$$$ |$$ | $$ |$$ | $$ |
-- \__| \__| \__| \______/ \______/ \__| \__|\________| \______/ \______/ \_______/ \__| \__|\__| \__|
function progressBar(seconds, item, min, max, label, reqitem, reqitemamount, previousProcessItem, ingredients)
exports["progressbar"]:Progress(
{
name = "Process",
duration = seconds,
label = label,
useWhileDead = false,
canCancel = true,
controlDisables = {
disableMovement = true,
disableCarMovement = false,
disableMouse = false,
disableCombat = true
}
},
function(cancelled)
if not cancelled then
local playerID = GetPlayerServerId(PlayerId())
ClearPedTasks(PlayerPedId())
TriggerServerEvent(
"bit-drugscreator:giveitem",
playerID,
item,
min,
max,
reqitem,
reqitemamount,
previousProcessItem,
ingredients
)
else
local playerID = GetPlayerServerId(PlayerId())
notifications(Noti.error, Lang.cancelled, Noti.time)
ClearPedTasks(PlayerPedId())
end
end
)
end
s_config.lua (server side)
-- $$$$$$\ $$$$$$\ $$\ $$\ $$$$$$$$\ $$$$$$\ $$$$$$$$\ $$$$$$$$\ $$\ $$\
-- $$ __$$\ \_$$ _|$$ | $$ |$$ _____| \_$$ _|\__$$ __|$$ _____|$$$\ $$$ |
-- $$ / \__| $$ | $$ | $$ |$$ | $$ | $$ | $$ | $$$$\ $$$$ |
-- $$ |$$$$\ $$ | \$$\ $$ |$$$$$\ $$ | $$ | $$$$$\ $$\$$\$$ $$ |
-- $$ |\_$$ | $$ | \$$\$$ / $$ __| $$ | $$ | $$ __| $$ \$$$ $$ |
-- $$ | $$ | $$ | \$$$ / $$ | $$ | $$ | $$ | $$ |\$ /$$ |
-- \$$$$$$ |$$$$$$\ \$ / $$$$$$$$\ $$$$$$\ $$ | $$$$$$$$\ $$ | \_/ $$ |
-- \______/ \______| \_/ \________| \______| \__| \________|\__| \__|
function giveItem(playerID, item, amount)
if Config.Framework == "esx" then
local xPlayer = ESX.GetPlayerFromId(playerID)
xPlayer.addInventoryItem(item, amount)
else
local Player = QBCore.Functions.GetPlayer(playerID)
Player.Functions.AddItem(item, amount)
end
end
-- $$$$$$$\ $$$$$$$$\ $$\ $$\ $$$$$$\ $$\ $$\ $$$$$$$$\ $$$$$$\ $$$$$$$$\ $$$$$$$$\ $$\ $$\
-- $$ __$$\ $$ _____|$$$\ $$$ |$$ __$$\ $$ | $$ |$$ _____| \_$$ _|\__$$ __|$$ _____|$$$\ $$$ |
-- $$ | $$ |$$ | $$$$\ $$$$ |$$ / $$ |$$ | $$ |$$ | $$ | $$ | $$ | $$$$\ $$$$ |
-- $$$$$$$ |$$$$$\ $$\$$\$$ $$ |$$ | $$ |\$$\ $$ |$$$$$\ $$ | $$ | $$$$$\ $$\$$\$$ $$ |
-- $$ __$$< $$ __| $$ \$$$ $$ |$$ | $$ | \$$\$$ / $$ __| $$ | $$ | $$ __| $$ \$$$ $$ |
-- $$ | $$ |$$ | $$ |\$ /$$ |$$ | $$ | \$$$ / $$ | $$ | $$ | $$ | $$ |\$ /$$ |
-- $$ | $$ |$$$$$$$$\ $$ | \_/ $$ | $$$$$$ | \$ / $$$$$$$$\ $$$$$$\ $$ | $$$$$$$$\ $$ | \_/ $$ |
-- \__| \__|\________|\__| \__| \______/ \_/ \________| \______| \__| \________|\__| \__|
function removeItem(playerID, item, amount)
if Config.Framework == "esx" then
local xPlayer = ESX.GetPlayerFromId(playerID)
local remove = xPlayer.removeInventoryItem(item, amount)
else
local Player = QBCore.Functions.GetPlayer(playerID)
Player.Functions.RemoveItem(item, amount)
end
end
-- $$$$$$\ $$\ $$\ $$$$$$$$\ $$$$$$\ $$\ $$\ $$$$$$\ $$$$$$$$\ $$$$$$$$\ $$\ $$\
-- $$ __$$\ $$ | $$ |$$ _____|$$ __$$\ $$ | $$ | \_$$ _|\__$$ __|$$ _____|$$$\ $$$ |
-- $$ / \__|$$ | $$ |$$ | $$ / \__|$$ |$$ / $$ | $$ | $$ | $$$$\ $$$$ |
-- $$ | $$$$$$$$ |$$$$$\ $$ | $$$$$ / $$ | $$ | $$$$$\ $$\$$\$$ $$ |
-- $$ | $$ __$$ |$$ __| $$ | $$ $$< $$ | $$ | $$ __| $$ \$$$ $$ |
-- $$ | $$\ $$ | $$ |$$ | $$ | $$\ $$ |\$$\ $$ | $$ | $$ | $$ |\$ /$$ |
-- \$$$$$$ |$$ | $$ |$$$$$$$$\ \$$$$$$ |$$ | \$$\ $$$$$$\ $$ | $$$$$$$$\ $$ | \_/ $$ |
-- \______/ \__| \__|\________| \______/ \__| \__| \______| \__| \________|\__| \__|
function checkIfHaveItem(playerID, item, amount)
if Config.Framework == "esx" then
local xPlayer = ESX.GetPlayerFromId(playerID)
local searchitem = xPlayer.getInventoryItem(item)
if searchitem ~= nil then
if searchitem.count >= amount then
return true
else
return false
end
else
return false
end
else
print ("elemento")
print (item, amount)
local Player = QBCore.Functions.GetPlayer(playerID)
local searchitem = Player.Functions.GetItemByName(item)
if searchitem ~= nil then
if searchitem.amount >= amount then
return true
else
return false
end
else
return false
end
end
end
Last updated