Skip to content
Open
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
10 changes: 6 additions & 4 deletions [esx_addons]/esx_drugs/server/main.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
local playersProcessingCannabis = {}
local outofbound = true
local outofbound = {}
local alive = true

local function ValidatePickupCannabis(src)
Expand Down Expand Up @@ -101,7 +101,7 @@ end)

RegisterServerEvent('esx_drugs:outofbound')
AddEventHandler('esx_drugs:outofbound', function()
outofbound = true
outofbound[source] = true
end)

ESX.RegisterServerCallback('esx_drugs:cannabis_count', function(source, cb)
Expand All @@ -118,9 +118,9 @@ AddEventHandler('esx_drugs:processCannabis', function()
local xPlayer = ESX.Player(source)
local xCannabis = xPlayer.getInventoryItem('cannabis')
local can = true
outofbound = false
outofbound[source] = false
if xCannabis.count >= 3 then
while outofbound == false and can do
while outofbound[source] == false and can do
if playersProcessingCannabis[source] == nil then
playersProcessingCannabis[source] = ESX.SetTimeout(Config.Delays.WeedProcessing , function()
if xCannabis.count >= 3 then
Expand Down Expand Up @@ -157,6 +157,8 @@ AddEventHandler('esx_drugs:processCannabis', function()
end)

function CancelProcessing(playerId)
outofbound[playerId] = nil

if playersProcessingCannabis[playerId] then
ESX.ClearTimeout(playersProcessingCannabis[playerId])
playersProcessingCannabis[playerId] = nil
Expand Down