project-sloth / ps-drugprocessing Goto Github PK
View Code? Open in Web Editor NEWAn advanced drug script by Project Sloth
Home Page: https://discord.gg/projectsloth
License: GNU General Public License v3.0
An advanced drug script by Project Sloth
Home Page: https://discord.gg/projectsloth
License: GNU General Public License v3.0
Few reporting this in the Discord and I have the same issue with a fresh install
Hello, we have the problem that we cannot always or collect every plant in the HeroinField? then you have to look at other plants that don't work either D:
Weed Processing- No target
HydrochloricAcid Farm- no target
Pickup Coke leafs- nothing happens
Heroin Processing - no target
There may be an issue with coke processing with the processing coca powder part, in client/coke.lua
QBCore.Functions.TriggerCallback('ps-drugprocessing:validate_items', function(result)
if result then
CutCokePowder()
else
QBCore.Functions.Notify(Lang:t("error.not_all_items"), 'error')
end
end, check)
If you don't have the right items, no matter if its the 1 finescale, 5 baking soda or 10 cocaine it just throws the same error "You do not have the right items needed". You need the correct amount(or more) of all items for the check to pass then it works fine. Other steps it tells you specifically what item you are missing.
There is a check serverside (server/coke.lua) for baking soda & cocaine, but it does not get triggered because the client side forces you to have the right amount. There is no actual check and error for missing the finescale at all.
if Player.Functions.RemoveItem('bakingsoda', Config.CokeProcessing.BakingSoda) then
TriggerClientEvent('QBCore:Notify', src, Lang:t("error.no_bakingsoda_amount"), "error")
end
else
TriggerClientEvent('QBCore:Notify', src, Lang:t("error.no_cokain_amount"), "error")```
If I have the cocainekey third eyeing Draco to enter the lab doesn't work.
local QBCore = exports['qb-core']:GetCoreObject()
local spawnedSulfuricAcidBarrels = 0
local SulfuricAcidBarrels = {}
Citizen.CreateThread(function()
while true do
Citizen.Wait(10)
local coords = GetEntityCoords(PlayerPedId())
if GetDistanceBetweenCoords(coords, Config.CircleZones.SulfuricAcidFarm.coords, true) < 50 then
SpawnSulfuricAcidBarrels()
Citizen.Wait(500)
else
Citizen.Wait(500)
end
end
end)
RegisterNetEvent("ps-drugprocessing:pickSulfuric")
AddEventHandler("ps-drugprocessing:pickSulfuric", function()
Citizen.Wait(0)
local playerPed = PlayerPedId()
local coords = GetEntityCoords(playerPed)
local nearbyObject, nearbyID
for i=1, #SulfuricAcidBarrels, 1 do
if GetDistanceBetweenCoords(coords, GetEntityCoords(SulfuricAcidBarrels[i]), false) < 2 then
nearbyObject, nearbyID = SulfuricAcidBarrels[i], i
end
end
if nearbyObject and IsPedOnFoot(playerPed) then
if not isPickingUp then
isPickingUp = true
TaskStartScenarioInPlace(playerPed, 'world_human_gardener_plant', 0, false)
QBCore.Functions.Progressbar("search_register", Lang:t("progressbar.collecting"), 10000, false, true, {
disableMovement = true,
disableCarMovement = true,
disableMouse = false,
disableCombat = true,
}, {}, {}, {}, function() -- Done
ClearPedTasks(PlayerPedId())
SetEntityAsMissionEntity(nearbyObject, false, true)
DeleteObject(nearbyObject)
table.remove(SulfuricAcidBarrels, nearbyID)
spawnedSulfuricAcidBarrels = spawnedSulfuricAcidBarrels - 1
TriggerServerEvent('ps-drugprocessing:pickedUpSulfuricAcid')
end, function()
ClearPedTasks(PlayerPedId())
end)
isPickingUp = false
end
else
Citizen.Wait(500)
end
end)
AddEventHandler('onResourceStop', function(resource)
if resource == GetCurrentResourceName() then
for k, v in pairs(SulfuricAcidBarrels) do
SetEntityAsMissionEntity(v, false, true)
DeleteObject(v)
end
end
end)
function SpawnSulfuricAcidBarrels()
while spawnedSulfuricAcidBarrels < 15 do
Citizen.Wait(0)
local sulfuricCoords = GenerateSulfuricAcidCoords()
RequestModel(`mw_sulfuric_barrel`)
while not HasModelLoaded(`mw_sulfuric_barrel`) do
Wait(100)
end
local obj = CreateObject(`mw_sulfuric_barrel`, sulfuricCoords.x, sulfuricCoords.y, sulfuricCoords.z, true, true, false)
PlaceObjectOnGroundProperly(obj)
FreezeEntityPosition(obj, true)
table.insert(SulfuricAcidBarrels, obj)
spawnedSulfuricAcidBarrels = spawnedSulfuricAcidBarrels + 1
end
end
function ValidateSulfuricAcidCoord(plantCoord)
if spawnedSulfuricAcidBarrels > 0 then
local validate = true
for k, v in pairs(SulfuricAcidBarrels) do
if GetDistanceBetweenCoords(plantCoord, GetEntityCoords(v), true) < 5 then
validate = false
end
end
if GetDistanceBetweenCoords(plantCoord, Config.CircleZones.SulfuricAcidFarm.coords, false) > 50 then
validate = false
end
return validate
else
return true
end
end
function GenerateSulfuricAcidCoords()
while true do
Citizen.Wait(1)
local sulfuricCoordX, sulfuricCoordY
math.randomseed(GetGameTimer())
local modX = math.random(-7, 7)
Citizen.Wait(100)
math.randomseed(GetGameTimer())
local modY = math.random(-7, 7)
sulfuricCoordX = Config.CircleZones.SulfuricAcidFarm.coords.x + modX
sulfuricCoordY = Config.CircleZones.SulfuricAcidFarm.coords.y + modY
local coordZ = GetCoordZSulfuricAcid(sulfuricCoordX, sulfuricCoordY)
local coord = vector3(sulfuricCoordX, sulfuricCoordY, coordZ)
if ValidateSulfuricAcidCoord(coord) then
return coord
end
end
end
function GetCoordZSulfuricAcid(x, y)
local groundCheckHeights = { 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 150.0 }
for i, height in ipairs(groundCheckHeights) do
local foundGround, z = GetGroundZFor_3dCoord(x, y, height)
if foundGround then
return z
end
end
return 18.31
end
RegisterNetEvent('ps-drugprocessing:ProcessCocaFarm')
AddEventHandler('ps-drugprocessing:ProcessCocaFarm', function()
local coords = GetEntityCoords(PlayerPedId(source))
if GetDistanceBetweenCoords(coords, Config.CircleZones.CokeProcessing.coords, true) < 5 then
if not isProcessing then
QBCore.Functions.TriggerCallback('QBCore:HasItem', function(result)
if result then
print('You have this item SA')
hasitem1 = true
else
QBCore.Functions.Notify('You need Coca Leafs!...', 'error')
end
end, 'coca_leaf')
Citizen.Wait(1000) -- BUFFER
QBCore.Functions.TriggerCallback('QBCore:HasItem', function(result)
if result and hasitem1 then
print('You have this item HA')
ProcessCoke()
else
QBCore.Functions.Notify('You need Scissors to cut with!..', 'error')
end
end, 'trimming_scissors')
end
end
end)
cocaine lab not working
packaging small coke bricks into large coke bricks doesnt work, dont know why but it says you dont have coke package when you do have them.
When "packing" the meth, the process bar shows up, but when it is done no item is given, and the meth tray is not removed.
Latest update #47
After processing the items into Chem Mix - works fine
Then going to cool them to Chem Vapor - Works fine
But
When going to heat the Chem Vapor to Tray just gives another Vapor again doesnt work
Say it removes Chem mix to Vapor, doesnt issue a tray sadly
While processing any drug, If someone cuff/rob and takes the item required to process,
after the process is finished you still get the item.
Its like there is no item check after progress is finished
hi how do i get weed lab to get working i dont understand to weed and coke lab have the same coords
Flags up virus warnings for Trojan virus
Is it possible to include the effects directly in the script from your side?
Because when I use the item e.g. heroin is does nothing.
Client/Coke/ Line 106
end, 'coke_small_brick', Config.CokeProcessing.SmallCokeBrick)
This line needs to be changed to
end, 'coke_small_brick', Config.CokeProcessing.SmallBrick)
It's pulling the wrong config for hasitem check.
Heroin Process dose not take away poppy resin when made into shot you can make unlimited shots with only 1 poppy
Most plants do not work when harvesting - I've already made the #53 merge and it still did not fix my issue.
Please refer to the video: https://medal.tv/games/gta-v/clips/lu13kTETG-Rss/d133727xHbxN?invite=cr-MSw2aVMsNjgzMzQ2NTks
I found out that when the go to reaches that point, nothing happens
So i have poly zones setup and working great but only for a few things.
Weed: 10 or so spawns per player
Coke Leaves: 10 or so spawns per player
Poppies: 10 or so spawns per player
Chemicals: 10 or so spawns per player
Sodium: 1 spawn per player
Hydro: 1 spawn per player
Sulfuric: 1 spawn per player
No idea why the Sodium, hydro and sulfuric only spawn one per player,
One thing id love too see if just too be able too set a spawn limit within the poly zone/circle zones, and remove the playerpedid stuff cause then servers run into the issue on if 5 people turn up too weed then that 10 plants turns into 50+ and you have too try and find the plants that belong too your ID instead of being able too just pick any plant, instead maybe could have a this plate is being picked if someone try's too pick the same plant?
Otherwise i love this script and would love too see it evolve into the must have drug script for any fivem server.
getting this error when trying to interact with some items, such as draco. weed, etc.
some "target items" dont work, ie you can have the leafs on you but it will not process. the meth processing with all the acid takes my items, but gives nothing in return. i put all things in where they belong, maybe i'm missing something.
do i need to remove the original qb-drugs?
Is there any way to change or remove the effect of the drug? With NVE it's not even possible to see.
If possible please add trimming_scissors and baking soda images
for all the acids there is only 1 maybe 2 barrels at most chems is perfect also i wont let m,e change the coords of coke processing
I am having issues with my meth lab, such as me not being able to start any of the meth processes. I believe it is due to the fact that the meth location was change but at that point the meth function should still be able to work properly.
Not working with the new qb-target v5.4.0
Plzz update to the new qb-target
-When adding the chemicals in the first part of the Meth Processing, the process is done, the progress bar is gone, stand there and nothing else happens, so you go to the next step and qb-notify says "processing has stopped because you abandoned the area". The was nothing more to do for that step?
-When processing the chemicals at Humane, tho you're selecting to make and are recieving LSA, the notify is showing "The Sulfuric Acid Process Was Successful".
Testing this out - seems I can goto Weed Process and process without the Plants
local QBCore = exports['qb-core']:GetCoreObject()
local spawnedSulfuricAcidBarrels = 0
local SulfuricAcidBarrels = {}
Citizen.CreateThread(function()
while true do
Citizen.Wait(10)
local coords = GetEntityCoords(PlayerPedId())
if GetDistanceBetweenCoords(coords, Config.CircleZones.SulfuricAcidFarm.coords, true) < 50 then
SpawnSulfuricAcidBarrels()
Citizen.Wait(500)
else
Citizen.Wait(500)
end
end
end)
RegisterNetEvent("ps-drugprocessing:pickSulfuric")
AddEventHandler("ps-drugprocessing:pickSulfuric", function()
Citizen.Wait(0)
local playerPed = PlayerPedId()
local coords = GetEntityCoords(playerPed)
local nearbyObject, nearbyID
for i=1, #SulfuricAcidBarrels, 1 do
if GetDistanceBetweenCoords(coords, GetEntityCoords(SulfuricAcidBarrels[i]), false) < 2 then
nearbyObject, nearbyID = SulfuricAcidBarrels[i], i
end
end
if nearbyObject and IsPedOnFoot(playerPed) then
if not isPickingUp then
isPickingUp = true
TaskStartScenarioInPlace(playerPed, 'world_human_gardener_plant', 0, false)
QBCore.Functions.Progressbar("search_register", Lang:t("progressbar.collecting"), 10000, false, true, {
disableMovement = true,
disableCarMovement = true,
disableMouse = false,
disableCombat = true,
}, {}, {}, {}, function() -- Done
ClearPedTasks(PlayerPedId())
SetEntityAsMissionEntity(nearbyObject, false, true)
DeleteObject(nearbyObject)
table.remove(SulfuricAcidBarrels, nearbyID)
spawnedSulfuricAcidBarrels = spawnedSulfuricAcidBarrels - 1
TriggerServerEvent('ps-drugprocessing:pickedUpSulfuricAcid')
end, function()
ClearPedTasks(PlayerPedId())
end)
isPickingUp = false
end
else
Citizen.Wait(500)
end
end)
AddEventHandler('onResourceStop', function(resource)
if resource == GetCurrentResourceName() then
for k, v in pairs(SulfuricAcidBarrels) do
SetEntityAsMissionEntity(v, false, true)
DeleteObject(v)
end
end
end)
function SpawnSulfuricAcidBarrels()
while spawnedSulfuricAcidBarrels < 15 do
Citizen.Wait(0)
local sulfuricCoords = GenerateSulfuricAcidCoords()
RequestModel(mw_sulfuric_barrel
)
while not HasModelLoaded(mw_sulfuric_barrel
) do
Wait(100)
end
local obj = CreateObject(mw_sulfuric_barrel
, sulfuricCoords.x, sulfuricCoords.y, sulfuricCoords.z, true, true, false)
PlaceObjectOnGroundProperly(obj)
FreezeEntityPosition(obj, true)
table.insert(SulfuricAcidBarrels, obj)
spawnedSulfuricAcidBarrels = spawnedSulfuricAcidBarrels + 1
end
end
function ValidateSulfuricAcidCoord(plantCoord)
if spawnedSulfuricAcidBarrels > 0 then
local validate = true
for k, v in pairs(SulfuricAcidBarrels) do
if GetDistanceBetweenCoords(plantCoord, GetEntityCoords(v), true) < 5 then
validate = false
end
end
if GetDistanceBetweenCoords(plantCoord, Config.CircleZones.SulfuricAcidFarm.coords, false) > 50 then
validate = false
end
return validate
else
return true
end
end
function GenerateSulfuricAcidCoords()
while true do
Citizen.Wait(1)
local sulfuricCoordX, sulfuricCoordY
math.randomseed(GetGameTimer())
local modX = math.random(-7, 7)
Citizen.Wait(100)
math.randomseed(GetGameTimer())
local modY = math.random(-7, 7)
sulfuricCoordX = Config.CircleZones.SulfuricAcidFarm.coords.x + modX
sulfuricCoordY = Config.CircleZones.SulfuricAcidFarm.coords.y + modY
local coordZ = GetCoordZSulfuricAcid(sulfuricCoordX, sulfuricCoordY)
local coord = vector3(sulfuricCoordX, sulfuricCoordY, coordZ)
if ValidateSulfuricAcidCoord(coord) then
return coord
end
end
end
function GetCoordZSulfuricAcid(x, y)
local groundCheckHeights = { 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 150.0 }
for i, height in ipairs(groundCheckHeights) do
local foundGround, z = GetGroundZFor_3dCoord(x, y, height)
if foundGround then
return z
end
end
return 18.31
end
It's possible to infinitly process cocaleafs to cocain piles.
Unable to target / pick most of the drugs
I've tried with heroin and also with coca leaves and both do the same thing? Any idea what could be causing this?
You can actually bypass gathering the materials, and mixing by just going to the decrease heat target. It will give you a meth tray.
Trying to pick coke leaves, I am not getting the option on target.
I have tried replacing the model with the poppy plant, which works.
So my thought is that it is the model that somehow is bugging.
It is a fresh install
Edit: All other drugs are working
Edit: Just posted this issue at qb-target as I was having the same error with another script [qb-target ticket]
SCRIPT ERROR: @ps-drugprocessing/client/coke.lua:141: attempt to call a nil value (field 'LoadModel')
and that line is
QBCore.Functions.LoadModel(mw_coke_plant
)
on coke field is empty
Weed doesnt seem to work, my players cant pick it up, tested myself. Text me if more info is needed
Having an issue where the weed table doesn't allow me to process: https://discordapp.com/channels/897744257237000222/900180032935325707/968225836929015878
Also having an issue where my meth freezes after completing minigame: https://discordapp.com/channels/897744257237000222/900180032935325707/968018393611513867
No issues when pressing F8 or in my console. What could be causing these? I followed all the steps that I know of.
the thionylchlorideProcessing at "vector3(-679.59, 5800.46, 17.33)" doesnt work
What do you need to interact with both targets? I attempted many things but can't seem to figure it out.
I've noticed over the past few days for everyone that has been doing it, that the coke processing has been pushing the same exact amount each time until either server or script restarts. Looking into it, from what I can gather is that the config isn't refreshing the random number each time the event is triggered. It sets one number each restart and sends it each time to the event.
I don't really know how to do a pull request here to be honest, but I was able to resolve this and get varying numbers each event trigger by moving the math.random to the server event on the coke processing and the small bricks. Attached image is how I fixed it. Lines 18 and 36 added and changed the Config.CokeProcessing.ProcessCokeLeaf(lines 21 and 23) and Config.CokeProcessing.SmallCokeBrick(lines 40 and 43) to the local total.
if this isnt right, let me know, but it is working fine for me.
I also assume that the math.random for meth processing is also causing issues, but I have not looked into that as of this moment.
I have had 10 Coke Powder and 5 Baking Soda. But still when I try to refine it does not give feedback or output. Using third eye action to refine does nothing. No errors on console.
Hello everyone, like the title if it's possible to add the options to use E for interaction instead of target because it's a farm job and my players harvest for long time (4/5H) and very annoyed by the target
Hi there, firstly i wanna say this is the best drug script ever. Is there anyway to remove the E thing on harvesting weed. Thanks in advance
this script have npc selling and how to enable blip on map
Having the ability to enable each client to select the hud position and the generic sizing that they want would be amazing. if we really want to make it even sweeter would allow admins to toggle each field to enable for client modification, populating the same component with the client side fields that admins would see, but slimmed down.
perhaps saving those few fields in the player table, or even its own, based off a license id would mean that different CID's wouldn't have to set up the positioning for each character. also, it'd be a smaller table. If they don't have it modified, default to the server's default settings.
There seems to be an issue with respawning. None of the items to be picked respawn unless you leave the area and come back. Sodium Hydroxide & heroin field are the exceptions(See below). Also, it seems like none of these are following the radius I set. No matter what I set(I set it to 20 for e.x), they seem to keep spawning at an 100 radius.
Note: I've only changed the animations for picking chemicals, and the progressbar for it.. that is it.
Weedfield - Does not respawn unless you leave the area and come back
HydrochloricAcidFar - Does not respawn unless you leave the area and come back
SulfuricAcidFarm - Does not respawn unless you leave the area and come back
SodiumHydroxideFarm -Respawns almost instantly, always in the same spots.
chemicalsfield - Does not respawn unless you leave the area and come back
cokefield - Does not respawn unless you leave the area and come back
heroinfield - Looks to be respawning perfectly fine, not following radius set
Edit: Heres a video: https://youtu.be/iPGEQxkg0EM
When multiple people go to farm coca leaves it becomes very messy not being client sided.
Plants fall through the floor and vanish when running up to them frequently.
Hello, i have some problems with the new update.
the variables "result.ret" and "result.item" are boolean or nil and cannot be processed by the RegisterNetEvent (error on result.ret and if i remove it on result.item), says the same for all other drugs with the news variables.
RegisterNetEvent('ps-drugprocessing:ProcessCocaFarm', function()
local coords = GetEntityCoords(PlayerPedId())
if #(coords-Config.CircleZones.CokeProcessing.coords) < 5 then
if not isProcessing then
QBCore.Functions.TriggerCallback('ps-drugprocessing:validate_items', function(result)
if result.ret then
ProcessCoke()
else
QBCore.Functions.Notify(Lang:t("error.no_item", {item = result.item}))
end
end, {coca_leaf = Config.CokeProcessing.CokeLeaf, trimming_scissors = 1})
end
end
end)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.