💊Documentation
All information you need foredit and use the script
Setup your framework
Setup your inventory system
Config
Money type
Config.moneyType = "money" -- Money type from your framework
Use ox_target
Config.useOxTarget = true -- Use ox_target or not
Cops required and Count
Config.copsCountRefreshTime = 5 -- Time in minutes to refresh cops count
Config.minCopsOnline = 0 -- Cops required to sell drugs
Ped reject and Ped Call Cops
Config.pedReject = 25 -- Percent chance that the ped will reject the drugs
Config.pedCallCops = 25 -- Percent chance that the ped will call the cops
BlacklistedJobs and CallCopsJobs
Config.blacklistedJobs = { "police", "bcso", "ambulance" } -- Job that can't sell drugs
Config.callCopsJos = { "police", "bcso" } -- Job who receive alert when ped call cops
Max drugs to sell
Config.maxDrugsToSell = 10 -- Max drugs to sell at once
Drugs amount for price variation and PriceVariation
Config.drugsSellQttyForVariation = 10 --Qtty of drugs to sell for price variation
Config.drugsPriceVariation = 0.05 -- 0.5% of variation
Drugs
Config.Drugs = {
weed = { -- Item name
price = 60, -- Price of the item
min = 40, -- Min price of the item
max = 80, -- Max price of the item
variation = { -- Item variation when you sell more than Config.drugsSellQttyForVariation
'meth' -- Item name
}
},
coke = {
price = 80,
min = 60,
max = 100,
variation = {
'weed',
'meth'
}
},
meth = {
price = 70,
min = 50,
max = 90,
variation = {
'cook'
}
}
}
Client : Notify.lua
Notify
---@param message string
---@param type 'success' | 'error'
function notify(message, type)
lib.notify({
title = locale('sell_drugs'),
description = message,
type = type,
})
end
Call cops event
---@param streetName string
---@param coords vector3
---@param pedMugshot image
RegisterNetEvent('axio_sellDrugs:client:callCops', function(streetName, coords, pedMugshot)
...
end)
Client : inventory.lua
Server : functions.lua
removeItemAndGiveMoney
---@param source int
---@param drug string
---@param qtty int
---@param price int
function removeItemAndGiveMoney(source, drug, qtty, price)
if Config.framework == "esx" then
player = ESX.GetPlayerFromId(source)
elseif Config.framework == "qbcore" then
player = QB.Functions.GetPlayer(source)
end
--[[ Remove item ]]
if Config.inventoryType == "esx" then
player.removeInventoryItem(drug, qtty)
elseif Config.inventoryType == "qbcore" then
player.Functions.RemoveItem(drug, qtty)
end
--[[ Give money ]]
if Config.framework == "esx" then
player.addAccountMoney(Config.moneyType, price)
elseif Config.framework == "qbcore" then
player.Functions.AddMoney(Config.moneyType, price)
end
end
call Cops Event
---@param streetName string
---@param coords vector3
---@param pedMugshot image
RegisterNetEvent('axio_sellDrugs:server:callCops', function(streetName, coords, pedMugshot)
...
end)
Last updated