Merge pull request #135 from itschip/unfuck

fix(drugs/server): removing check for health, becuause why the fuck
This commit is contained in:
Christopher Gjelten
2020-12-06 15:40:07 +01:00
committed by GitHub
2 changed files with 11 additions and 12 deletions
+4 -4
View File
@@ -49,11 +49,11 @@ end)
function ProcessWeed(xCannabis)
isProcessing = true
ESX.ShowNotification(_U('weed_processingstarted'))
TriggerServerEvent('esx_drugs:processCannabis')
if(xCannabis<3) then
xCannabis=0
TriggerServerEvent('esx_drugs:processCannabis')
if(xCannabis <= 3) then
xCannabis = 0
end
local timeLeft = (Config.Delays.WeedProcessing * xCannabis) / 1000
local timeLeft = (Config.Delays.WeedProcessing * xCannabis) / 1000
local playerPed = PlayerPedId()
while timeLeft > 0 do
+7 -8
View File
@@ -88,21 +88,20 @@ end)
RegisterServerEvent('esx_drugs:processCannabis')
AddEventHandler('esx_drugs:processCannabis', function()
if not playersProcessingCannabis[source] then
if not playersProcessingCannabis[source] then
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local xCannabis = xPlayer.getInventoryItem('cannabis')
TriggerClientEvent('esx_drugs:getPlayer',xCannabis.count,_source)
local can = true
outofbound = false
if xCannabis.count >=3 then
while outofbound == false and can and GetEntityHealth(GetPlayerPed(_source))>0 do
if xCannabis.count >= 3 then
while outofbound == false and can do
if playersProcessingCannabis[_source] == nil then
playersProcessingCannabis[_source] = ESX.SetTimeout(Config.Delays.WeedProcessing , function()
if xCannabis.count >= 3 then
if xPlayer.canSwapItem('cannabis', 3, 'marijuana', 1) then
xPlayer.removeInventoryItem('cannabis', 3)
xPlayer.addInventoryItem('marijuana', 1)
if xCannabis.count >= 3 then
if xPlayer.canSwapItem('cannabis', 3, 'marijuana', 1) then
xPlayer.removeInventoryItem('cannabis', 3)
xPlayer.addInventoryItem('marijuana', 1)
xPlayer.showNotification(_U('weed_processed'))
else
can = false