From aa0749d51fa27d3884c9800a2ba25f1b66776ded Mon Sep 17 00:00:00 2001 From: StopherTv <63510365+StopherTv@users.noreply.github.com> Date: Tue, 26 Apr 2022 17:44:22 +0200 Subject: [PATCH] Update weed.lua Fix error when making transformation cannabis into marijuana if Config.LicenseEnable is enable (true). Error in client consol xCannabis is null and when exiting the zone transformation still running. --- [esx_addons]/esx_drugs/client/weed.lua | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/[esx_addons]/esx_drugs/client/weed.lua b/[esx_addons]/esx_drugs/client/weed.lua index 8becb871..0b821c18 100644 --- a/[esx_addons]/esx_drugs/client/weed.lua +++ b/[esx_addons]/esx_drugs/client/weed.lua @@ -26,20 +26,19 @@ CreateThread(function() end if IsControlJustReleased(0, 38) and not isProcessing then - if Config.LicenseEnable then - ESX.TriggerServerCallback('esx_license:checkLicense', function(hasProcessingLicense) - if hasProcessingLicense then - ProcessWeed() - else - OpenBuyLicenseMenu('weed_processing') - end - end, GetPlayerServerId(PlayerId()), 'weed_processing') - else - ESX.TriggerServerCallback('esx_drugs:cannabis_count', function(xCannabis) + ESX.TriggerServerCallback('esx_drugs:cannabis_count', function(xCannabis) + if Config.LicenseEnable then + ESX.TriggerServerCallback('esx_license:checkLicense', function(hasProcessingLicense) + if hasProcessingLicense then + ProcessWeed(xCannabis) + else + OpenBuyLicenseMenu('weed_processing') + end + end, GetPlayerServerId(PlayerId()), 'weed_processing') + else ProcessWeed(xCannabis) - end) - - end + end + end) end end Wait(wait)