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

[FIX] infinite coke bug fix #40

Merged
merged 1 commit into from
May 1, 2022
Merged
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
25 changes: 14 additions & 11 deletions client/coke.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ local QBCore = exports['qb-core']:GetCoreObject()

local spawnedCocaLeaf = 0
local CocaPlants = {}
local isPickingUp, isProcessing, CWarehouse = false, false, false
local isPickingUp, isProcessing, CWarehouse, hasitem1, hasitem2 = false, false, false, false, false


Citizen.CreateThread(function()
Expand All @@ -29,19 +29,22 @@ AddEventHandler('ps-drugprocessing:ProcessCocaFarm', function()
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 do this!', 'error')
end
end, 'trimming_scissors')
if hasitem1 then
QBCore.Functions.TriggerCallback('QBCore:HasItem', function(result)
if result and hasitem1 then
print('You have this item HA')
ProcessCoke()
hasitem1 = false
else
QBCore.Functions.Notify('You need scissors to do this!', 'error')
end
end, 'trimming_scissors')
else
QBCore.Functions.Notify('You need Coca Leafs!', 'error')
end
end
end
end)
Expand Down