Kod:
RegisterServerEvent('esx_drugs:processweed')
AddEventHandler('esx_drugs:processweed', function()
if not playersProcessingweed[source] then
local _source = source
playersProcessingweed[_source] = ESX.SetTimeout(Config.Delays.WeedProcessing, function()
local xPlayer = ESX.GetPlayerFromId(_source)
xPlayer.removeInventoryItem('weed', 6)
local xweed, xMarijuana = xPlayer.getInventoryItem('weed'), xPlayer.getInventoryItem('marijuana')
if xPlayer.addInventoryItem('marijuana', 1) then
xPlayer.removeInventoryItem('weed', 6)
--xPlayer.addInventoryItem('marijuana', 1)
TriggerClientEvent('esx:showNotification', _source, _U('weed_processed'))
elseif xweed.count < 6 then
TriggerClientEvent('esx:showNotification', _source, _U('weed_processingenough'))
else
end
playersProcessingweed[_source] = nil
end)
else
print(('esx_drugs: %s attempted to exploit weed processing!'):format(GetPlayerIdentifiers(source)[1]))
end
end)
Kod bu şekilde 0 tane weed varken bile işliyor yardım edebilirmisiniz
Kod:
elseif xweed.count < 6 then
TriggerClientEvent('esx:showNotification', _source, _U('weed_processingenough'))