mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-04 16:23:21 +00:00
Implemented processing license
This commit is contained in:
+32
-14
@@ -29,23 +29,19 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
|
||||
if IsControlJustReleased(0, Keys['E']) and not isProcessing then
|
||||
isProcessing = true
|
||||
ESX.ShowNotification(_U('weed_processingstarted'))
|
||||
TriggerServerEvent('esx_drugs:processCannabis')
|
||||
local timeLeft = Config.Delays.WeedProcessing / 1000
|
||||
|
||||
while timeLeft > 0 do
|
||||
Citizen.Wait(1000)
|
||||
timeLeft = timeLeft - 1
|
||||
|
||||
if GetDistanceBetweenCoords(GetEntityCoords(playerPed), Config.CircleZones.WeedProcessing.coords, false) > 4 then
|
||||
ESX.ShowNotification(_U('weed_processingtoofar'))
|
||||
TriggerServerEvent('esx_drugs:cancelProcessing')
|
||||
break
|
||||
end
|
||||
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
|
||||
ProcessWeed()
|
||||
end
|
||||
|
||||
isProcessing = false
|
||||
end
|
||||
else
|
||||
Citizen.Wait(500)
|
||||
@@ -53,6 +49,28 @@ Citizen.CreateThread(function()
|
||||
end
|
||||
end)
|
||||
|
||||
function ProcessWeed()
|
||||
isProcessing = true
|
||||
|
||||
ESX.ShowNotification(_U('weed_processingstarted'))
|
||||
TriggerServerEvent('esx_drugs:processCannabis')
|
||||
local timeLeft = Config.Delays.WeedProcessing / 1000
|
||||
local playerPed = PlayerPedId()
|
||||
|
||||
while timeLeft > 0 do
|
||||
Citizen.Wait(1000)
|
||||
timeLeft = timeLeft - 1
|
||||
|
||||
if GetDistanceBetweenCoords(GetEntityCoords(playerPed), Config.CircleZones.WeedProcessing.coords, false) > 4 then
|
||||
ESX.ShowNotification(_U('weed_processingtoofar'))
|
||||
TriggerServerEvent('esx_drugs:cancelProcessing')
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
isProcessing = false
|
||||
end
|
||||
|
||||
Citizen.CreateThread(function()
|
||||
while true do
|
||||
Citizen.Wait(10)
|
||||
|
||||
Reference in New Issue
Block a user