Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Config Options for Processing #48

Merged
merged 2 commits into from
May 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 39 additions & 7 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,6 @@ Config.Delays = {
thionylchlorideProcessing = 1000 * 10,
}

Config.ChemicalsConvertionItems = {
hydrochloric_acid = 0,
sodium_hydroxide = 0,
sulfuric_acid = 0,
lsa = 0,
}

Config.CircleZones = {
WeedField = {coords = vector3(2224.64, 5577.03, 53.85), name = ('Weed Farm'), radius = 100.0},
WeedProcessing = {coords = vector3(2329.12, 2571.86, 46.68), name = ('Weed Process'), radius = 100.0},
Expand Down Expand Up @@ -71,3 +64,42 @@ Config.WeedLab = {
coords = vector4(1088.68, -3187.68, -38.99, 176.04), -- GTA DLC Biker Cocaine Lab -- vector3(1088.68, -3187.68, -38.99)
},]]--
}


--------------------------------
-- DRUG CONFIG AMOUNTS --
--------------------------------

--------------------------------
-- COKE PROCESSING AMOUNTS --
--------------------------------

Config.CokeProcessing = {
CokeLeaf = 1, -- Amount of Leaf Needed to Process
ProcessCokeLeaf = math.random(2,7), -- Amount of Coke Received
-- Processing Small Bricks --
Coke = 10, -- Amount of Coke Needed for Small Brick
BakingSoda = 5, -- Amount of Baking Soda Needed for Small Brick
SmallCokeBrick = math.random(2,7),
-- Process Small Bricks Into Large Brick --
SmallBrick = 4, -- Amount of Small Bricks Required
LargeBrick = 1, -- Large Bricks Received
}

--------------------------------
-- METH PROCESSING AMOUNTS --
--------------------------------
Config.MethProcessing = {
-- Chemical Processing --
SulfAcid = 1, -- Amount of Sulfuric Acid Needed for Liquid Mix
HydAcid = 1, -- Amount of Hydrochloric Acid Needed for Liquid Mix
SodHyd = 1, -- Amount of Sodium Hydroxide Needed for Liquid Mix
Meth = math.random(5,12), -- Amount of Meth Recevied From 1 Tray
}

--------------------------------
-- HEROIN PROCESSING AMOUNTS --
--------------------------------
Config.HeroinProcessing = {
Poppy = 2 -- Amount of Poppy Required for 1 Heroin
}
30 changes: 14 additions & 16 deletions server/coke.lua
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,25 @@ RegisterServerEvent('ps-drugprocessing:processCocaLeaf')
AddEventHandler('ps-drugprocessing:processCocaLeaf', function()
local src = source
local Player = QBCore.Functions.GetPlayer(src)
local count = math.random(2,7)

Player.Functions.RemoveItem('coca_leaf', 1)
Player.Functions.AddItem('coke', count)
TriggerClientEvent("inventory:client:ItemBox", source, QBCore.Shared.Items['coca_leaf'], "remove")
TriggerClientEvent("inventory:client:ItemBox", source, QBCore.Shared.Items['coke'], "add", count)
Player.Functions.RemoveItem('coca_leaf', Config.CokeProcessing.CokeLeaf)
Player.Functions.AddItem('coke', Config.CokeProcessing.ProcessCokeLeaf)
TriggerClientEvent("inventory:client:ItemBox", source, QBCore.Shared.Items['coca_leaf'], "remove", Config.CokeProcessing.CokeLeaf)
TriggerClientEvent("inventory:client:ItemBox", source, QBCore.Shared.Items['coke'], "add", Config.CokeProcessing.ProcessCokeLeaf)
TriggerClientEvent('QBCore:Notify', src, Lang:t("success.coke"), "success")
end)

RegisterServerEvent('ps-drugprocessing:processCocaPowder')
AddEventHandler('ps-drugprocessing:processCocaPowder', function()
local src = source
local Player = QBCore.Functions.GetPlayer(src)
local count = math.random(1,2)

Player.Functions.RemoveItem('coke', 10)
Player.Functions.RemoveItem('bakingsoda', 5)
Player.Functions.AddItem('coke_small_brick', count)
TriggerClientEvent("inventory:client:ItemBox", source, QBCore.Shared.Items['coke'], "remove", 10)
TriggerClientEvent("inventory:client:ItemBox", source, QBCore.Shared.Items['bakingsoda'], "remove", 5)
TriggerClientEvent("inventory:client:ItemBox", source, QBCore.Shared.Items['coke_small_brick'], "add", count)
Player.Functions.RemoveItem('coke', Config.CokeProcessing.Coke)
Player.Functions.RemoveItem('bakingsoda', Config.CokeProcessing.BakingSoda)
Player.Functions.AddItem('coke_small_brick', Config.CokeProcessing.SmallCokeBrick)
TriggerClientEvent("inventory:client:ItemBox", source, QBCore.Shared.Items['coke'], "remove", Config.CokeProcessing.Coke)
TriggerClientEvent("inventory:client:ItemBox", source, QBCore.Shared.Items['bakingsoda'], "remove", Config.CokeProcessing.BakingSoda)
TriggerClientEvent("inventory:client:ItemBox", source, QBCore.Shared.Items['coke_small_brick'], "add", Config.CokeProcessing.SmallCokeBrick)
TriggerClientEvent('QBCore:Notify', src, Lang:t("success.coke_small_brick"), "success")
end)

Expand All @@ -44,10 +42,10 @@ AddEventHandler('ps-drugprocessing:processCocaBrick', function()
local src = source
local Player = QBCore.Functions.GetPlayer(src)

Player.Functions.RemoveItem('coke_small_brick', 4)
Player.Functions.AddItem('coke_brick', 1)
TriggerClientEvent("inventory:client:ItemBox", source, QBCore.Shared.Items['coke_small_brick'], "remove", 4)
TriggerClientEvent("inventory:client:ItemBox", source, QBCore.Shared.Items['coke_brick'], "add", 1)
Player.Functions.RemoveItem('coke_small_brick', Config.CokeProcessing.SmallBrick)
Player.Functions.AddItem('coke_brick', Config.CokeProcessing.LargeBrick)
TriggerClientEvent("inventory:client:ItemBox", source, QBCore.Shared.Items['coke_small_brick'], "remove", Config.CokeProcessing.SmallBrick)
TriggerClientEvent("inventory:client:ItemBox", source, QBCore.Shared.Items['coke_brick'], "add", Config.CokeProcessing.LargeBrick)
TriggerClientEvent('QBCore:Notify', src, Lang:t("success.coke_brick"), "success")
end)

Expand Down
4 changes: 2 additions & 2 deletions server/heroin.lua
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ AddEventHandler('ps-drugprocessing:processPoppyResin', function()
local src = source
local Player = QBCore.Functions.GetPlayer(src)

Player.Functions.RemoveItem('poppyresin', 1)
Player.Functions.RemoveItem('poppyresin', Config.HeroinProcessing.Poppy)
Player.Functions.AddItem('heroin', 1)
TriggerClientEvent("inventory:client:ItemBox", source, QBCore.Shared.Items['poppyresin'], "remove")
TriggerClientEvent("inventory:client:ItemBox", source, QBCore.Shared.Items['poppyresin'], "remove", Config.HeroinProcessing.Poppy)
TriggerClientEvent("inventory:client:ItemBox", source, QBCore.Shared.Items['heroin'], "add")
TriggerClientEvent('QBCore:Notify', src, Lang:t("success.heroin"), "success")
end)
Expand Down
19 changes: 9 additions & 10 deletions server/meth.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ AddEventHandler('ps-drugprocessing:processChemicals', function()
local Player = QBCore.Functions.GetPlayer(src)

Player.Functions.AddItem("liquidmix", 1)
Player.Functions.RemoveItem("sulfuric_acid", 1)
Player.Functions.RemoveItem("hydrochloric_acid", 1)
Player.Functions.RemoveItem("sodium_hydroxide", 1)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["liquidmix"], "add")
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["sulfuric_acid"], "remove")
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["hydrochloric_acid"], "remove")
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["sodium_hydroxide"], "remove")
Player.Functions.RemoveItem("sulfuric_acid", Config.MethProcessing.SulfAcid)
Player.Functions.RemoveItem("hydrochloric_acid", Config.MethProcessing.HydAcid)
Player.Functions.RemoveItem("sodium_hydroxide", Config.MethProcessing.SodHyd)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["liquidmix"], "add", 1)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["sulfuric_acid"], "remove", Config.MethProcessing.SulfAcid)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["hydrochloric_acid"], "remove", Config.MethProcessing.HydAcid)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["sodium_hydroxide"], "remove", Config.MethProcessing.SodHyd)
end
end)

Expand Down Expand Up @@ -76,11 +76,10 @@ AddEventHandler('ps-drugprocessing:processMeth', function()
if not playersProcessingMeth[source] then
local src = source
local Player = QBCore.Functions.GetPlayer(src)
local quantity = math.random(5, 12)

Player.Functions.AddItem("meth", quantity)
Player.Functions.AddItem("meth", Config.Meth)
Player.Functions.RemoveItem("methtray", 1)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["meth"], "add")
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["meth"], "add", Config.MethProcessing.Meth)
TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["methtray"], "remove")
TriggerClientEvent('QBCore:Notify', src, Lang:t("success.meth"), "success")
end
Expand Down