mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 18:28:52 +00:00
Minor improvements, proper item limits
This commit is contained in:
+51
-163
@@ -16,7 +16,6 @@ local PlayersSellingOpium = {}
|
||||
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
|
||||
|
||||
function CountCops()
|
||||
|
||||
local xPlayers = ESX.GetPlayers()
|
||||
|
||||
CopsConnected = 0
|
||||
@@ -35,18 +34,14 @@ CountCops()
|
||||
|
||||
--coke
|
||||
local function HarvestCoke(source)
|
||||
|
||||
if CopsConnected < Config.RequiredCopsCoke then
|
||||
TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsCoke))
|
||||
return
|
||||
end
|
||||
|
||||
SetTimeout(Config.TimeToFarm, function()
|
||||
|
||||
if PlayersHarvestingCoke[source] == true then
|
||||
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
if PlayersHarvestingCoke[source] then
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
local coke = xPlayer.getInventoryItem('coke')
|
||||
|
||||
if coke.limit ~= -1 and coke.count >= coke.limit then
|
||||
@@ -55,14 +50,12 @@ local function HarvestCoke(source)
|
||||
xPlayer.addInventoryItem('coke', 1)
|
||||
HarvestCoke(source)
|
||||
end
|
||||
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
RegisterServerEvent('esx_drugs:startHarvestCoke')
|
||||
AddEventHandler('esx_drugs:startHarvestCoke', function()
|
||||
|
||||
local _source = source
|
||||
|
||||
PlayersHarvestingCoke[_source] = true
|
||||
@@ -70,53 +63,43 @@ AddEventHandler('esx_drugs:startHarvestCoke', function()
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog'))
|
||||
|
||||
HarvestCoke(_source)
|
||||
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_drugs:stopHarvestCoke')
|
||||
AddEventHandler('esx_drugs:stopHarvestCoke', function()
|
||||
|
||||
local _source = source
|
||||
|
||||
PlayersHarvestingCoke[_source] = false
|
||||
|
||||
end)
|
||||
|
||||
local function TransformCoke(source)
|
||||
|
||||
if CopsConnected < Config.RequiredCopsCoke then
|
||||
TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsCoke))
|
||||
return
|
||||
end
|
||||
|
||||
SetTimeout(Config.TimeToProcess, function()
|
||||
|
||||
if PlayersTransformingCoke[source] == true then
|
||||
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
|
||||
if PlayersTransformingCoke[source] then
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
local cokeQuantity = xPlayer.getInventoryItem('coke').count
|
||||
local poochQuantity = xPlayer.getInventoryItem('coke_pooch').count
|
||||
local pooch = xPlayer.getInventoryItem('coke_pooch').count
|
||||
|
||||
if poochQuantity > 35 then
|
||||
if pooch.limit ~= -1 and pooch.count >= pooch.limit then
|
||||
TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches'))
|
||||
elseif cokeQuantity < 5 then
|
||||
TriggerClientEvent('esx:showNotification', source, _U('not_enough_coke'))
|
||||
else
|
||||
xPlayer.removeInventoryItem('coke', 5)
|
||||
xPlayer.addInventoryItem('coke_pooch', 1)
|
||||
|
||||
|
||||
TransformCoke(source)
|
||||
end
|
||||
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
RegisterServerEvent('esx_drugs:startTransformCoke')
|
||||
AddEventHandler('esx_drugs:startTransformCoke', function()
|
||||
|
||||
local _source = source
|
||||
|
||||
PlayersTransformingCoke[_source] = true
|
||||
@@ -124,32 +107,24 @@ AddEventHandler('esx_drugs:startTransformCoke', function()
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog'))
|
||||
|
||||
TransformCoke(_source)
|
||||
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_drugs:stopTransformCoke')
|
||||
AddEventHandler('esx_drugs:stopTransformCoke', function()
|
||||
|
||||
local _source = source
|
||||
|
||||
PlayersTransformingCoke[_source] = false
|
||||
|
||||
end)
|
||||
|
||||
local function SellCoke(source)
|
||||
|
||||
if CopsConnected < Config.RequiredCopsCoke then
|
||||
TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsCoke))
|
||||
return
|
||||
end
|
||||
|
||||
SetTimeout(Config.TimeToSell, function()
|
||||
|
||||
if PlayersSellingCoke[source] == true then
|
||||
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
|
||||
if PlayersSellingCoke[source] then
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
local poochQuantity = xPlayer.getInventoryItem('coke_pooch').count
|
||||
|
||||
if poochQuantity == 0 then
|
||||
@@ -175,17 +150,15 @@ local function SellCoke(source)
|
||||
xPlayer.addAccountMoney('black_money', 428)
|
||||
TriggerClientEvent('esx:showNotification', source, _U('sold_one_coke'))
|
||||
end
|
||||
|
||||
|
||||
SellCoke(source)
|
||||
end
|
||||
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
RegisterServerEvent('esx_drugs:startSellCoke')
|
||||
AddEventHandler('esx_drugs:startSellCoke', function()
|
||||
|
||||
local _source = source
|
||||
|
||||
PlayersSellingCoke[_source] = true
|
||||
@@ -193,33 +166,25 @@ AddEventHandler('esx_drugs:startSellCoke', function()
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog'))
|
||||
|
||||
SellCoke(_source)
|
||||
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_drugs:stopSellCoke')
|
||||
AddEventHandler('esx_drugs:stopSellCoke', function()
|
||||
|
||||
local _source = source
|
||||
|
||||
PlayersSellingCoke[_source] = false
|
||||
|
||||
end)
|
||||
|
||||
--meth
|
||||
local function HarvestMeth(source)
|
||||
|
||||
if CopsConnected < Config.RequiredCopsMeth then
|
||||
TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsMeth))
|
||||
return
|
||||
end
|
||||
|
||||
SetTimeout(Config.TimeToFarm, function()
|
||||
|
||||
if PlayersHarvestingMeth[source] == true then
|
||||
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
|
||||
if PlayersHarvestingMeth[source] then
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
local meth = xPlayer.getInventoryItem('meth')
|
||||
|
||||
if meth.limit ~= -1 and meth.count >= meth.limit then
|
||||
@@ -228,14 +193,12 @@ local function HarvestMeth(source)
|
||||
xPlayer.addInventoryItem('meth', 1)
|
||||
HarvestMeth(source)
|
||||
end
|
||||
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
RegisterServerEvent('esx_drugs:startHarvestMeth')
|
||||
AddEventHandler('esx_drugs:startHarvestMeth', function()
|
||||
|
||||
local _source = source
|
||||
|
||||
PlayersHarvestingMeth[_source] = true
|
||||
@@ -243,53 +206,43 @@ AddEventHandler('esx_drugs:startHarvestMeth', function()
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog'))
|
||||
|
||||
HarvestMeth(_source)
|
||||
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_drugs:stopHarvestMeth')
|
||||
AddEventHandler('esx_drugs:stopHarvestMeth', function()
|
||||
|
||||
local _source = source
|
||||
|
||||
PlayersHarvestingMeth[_source] = false
|
||||
|
||||
end)
|
||||
|
||||
local function TransformMeth(source)
|
||||
|
||||
if CopsConnected < Config.RequiredCopsMeth then
|
||||
TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsMeth))
|
||||
return
|
||||
end
|
||||
|
||||
SetTimeout(Config.TimeToProcess, function()
|
||||
|
||||
if PlayersTransformingMeth[source] == true then
|
||||
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
|
||||
if PlayersTransformingMeth[source] then
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
local methQuantity = xPlayer.getInventoryItem('meth').count
|
||||
local poochQuantity = xPlayer.getInventoryItem('meth_pooch').count
|
||||
local pooch = xPlayer.getInventoryItem('meth_pooch')
|
||||
|
||||
if poochQuantity > 35 then
|
||||
if pooch.limit ~= -1 and pooch.count >= pooch.limit then
|
||||
TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches'))
|
||||
elseif methQuantity < 5 then
|
||||
TriggerClientEvent('esx:showNotification', source, _U('not_enough_meth'))
|
||||
else
|
||||
xPlayer.removeInventoryItem('meth', 5)
|
||||
xPlayer.addInventoryItem('meth_pooch', 1)
|
||||
|
||||
|
||||
TransformMeth(source)
|
||||
end
|
||||
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
RegisterServerEvent('esx_drugs:startTransformMeth')
|
||||
AddEventHandler('esx_drugs:startTransformMeth', function()
|
||||
|
||||
local _source = source
|
||||
|
||||
PlayersTransformingMeth[_source] = true
|
||||
@@ -297,36 +250,28 @@ AddEventHandler('esx_drugs:startTransformMeth', function()
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog'))
|
||||
|
||||
TransformMeth(_source)
|
||||
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_drugs:stopTransformMeth')
|
||||
AddEventHandler('esx_drugs:stopTransformMeth', function()
|
||||
|
||||
local _source = source
|
||||
|
||||
PlayersTransformingMeth[_source] = false
|
||||
|
||||
end)
|
||||
|
||||
local function SellMeth(source)
|
||||
|
||||
if CopsConnected < Config.RequiredCopsMeth then
|
||||
TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsMeth))
|
||||
return
|
||||
end
|
||||
|
||||
SetTimeout(Config.TimeToSell, function()
|
||||
|
||||
if PlayersSellingMeth[source] == true then
|
||||
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
|
||||
if PlayersSellingMeth[source] then
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
local poochQuantity = xPlayer.getInventoryItem('meth_pooch').count
|
||||
|
||||
if poochQuantity == 0 then
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('no_pouches_sale'))
|
||||
TriggerClientEvent('esx:showNotification', source, _U('no_pouches_sale'))
|
||||
else
|
||||
xPlayer.removeInventoryItem('meth_pooch', 1)
|
||||
if CopsConnected == 0 then
|
||||
@@ -351,17 +296,15 @@ local function SellMeth(source)
|
||||
xPlayer.addAccountMoney('black_money', 686)
|
||||
TriggerClientEvent('esx:showNotification', source, _U('sold_one_meth'))
|
||||
end
|
||||
|
||||
|
||||
SellMeth(source)
|
||||
end
|
||||
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
RegisterServerEvent('esx_drugs:startSellMeth')
|
||||
AddEventHandler('esx_drugs:startSellMeth', function()
|
||||
|
||||
local _source = source
|
||||
|
||||
PlayersSellingMeth[_source] = true
|
||||
@@ -369,33 +312,26 @@ AddEventHandler('esx_drugs:startSellMeth', function()
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog'))
|
||||
|
||||
SellMeth(_source)
|
||||
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_drugs:stopSellMeth')
|
||||
AddEventHandler('esx_drugs:stopSellMeth', function()
|
||||
|
||||
local _source = source
|
||||
|
||||
PlayersSellingMeth[_source] = false
|
||||
|
||||
end)
|
||||
|
||||
--weed
|
||||
local function HarvestWeed(source)
|
||||
|
||||
if CopsConnected < Config.RequiredCopsWeed then
|
||||
TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsWeed))
|
||||
return
|
||||
end
|
||||
|
||||
SetTimeout(Config.TimeToFarm, function()
|
||||
|
||||
if PlayersHarvestingWeed[source] == true then
|
||||
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
|
||||
local weed = xPlayer.getInventoryItem('weed')
|
||||
|
||||
if weed.limit ~= -1 and weed.count >= weed.limit then
|
||||
@@ -404,14 +340,12 @@ local function HarvestWeed(source)
|
||||
xPlayer.addInventoryItem('weed', 1)
|
||||
HarvestWeed(source)
|
||||
end
|
||||
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
RegisterServerEvent('esx_drugs:startHarvestWeed')
|
||||
AddEventHandler('esx_drugs:startHarvestWeed', function()
|
||||
|
||||
local _source = source
|
||||
|
||||
PlayersHarvestingWeed[_source] = true
|
||||
@@ -419,52 +353,44 @@ AddEventHandler('esx_drugs:startHarvestWeed', function()
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog'))
|
||||
|
||||
HarvestWeed(_source)
|
||||
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_drugs:stopHarvestWeed')
|
||||
AddEventHandler('esx_drugs:stopHarvestWeed', function()
|
||||
|
||||
local _source = source
|
||||
|
||||
PlayersHarvestingWeed[_source] = false
|
||||
|
||||
end)
|
||||
|
||||
local function TransformWeed(source)
|
||||
|
||||
if CopsConnected < Config.RequiredCopsWeed then
|
||||
TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsWeed))
|
||||
return
|
||||
end
|
||||
|
||||
SetTimeout(Config.TimeToProcess, function()
|
||||
|
||||
if PlayersTransformingWeed[source] == true then
|
||||
|
||||
if PlayersTransformingWeed[source] then
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
local weedQuantity = xPlayer.getInventoryItem('weed').count
|
||||
local poochQuantity = xPlayer.getInventoryItem('weed_pooch').count
|
||||
local pooch = xPlayer.getInventoryItem('weed_pooch')
|
||||
|
||||
if poochQuantity > 35 then
|
||||
if pooch.limit ~= -1 and pooch.count >= pooch.limit then
|
||||
TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches'))
|
||||
elseif weedQuantity < 5 then
|
||||
TriggerClientEvent('esx:showNotification', source, _U('not_enough_weed'))
|
||||
else
|
||||
xPlayer.removeInventoryItem('weed', 5)
|
||||
xPlayer.addInventoryItem('weed_pooch', 1)
|
||||
|
||||
|
||||
TransformWeed(source)
|
||||
end
|
||||
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
RegisterServerEvent('esx_drugs:startTransformWeed')
|
||||
AddEventHandler('esx_drugs:startTransformWeed', function()
|
||||
|
||||
local _source = source
|
||||
|
||||
PlayersTransformingWeed[_source] = true
|
||||
@@ -472,32 +398,25 @@ AddEventHandler('esx_drugs:startTransformWeed', function()
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog'))
|
||||
|
||||
TransformWeed(_source)
|
||||
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_drugs:stopTransformWeed')
|
||||
AddEventHandler('esx_drugs:stopTransformWeed', function()
|
||||
|
||||
local _source = source
|
||||
|
||||
PlayersTransformingWeed[_source] = false
|
||||
|
||||
end)
|
||||
|
||||
local function SellWeed(source)
|
||||
|
||||
if CopsConnected < Config.RequiredCopsWeed then
|
||||
TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsWeed))
|
||||
return
|
||||
end
|
||||
|
||||
SetTimeout(Config.TimeToSell, function()
|
||||
|
||||
if PlayersSellingWeed[source] == true then
|
||||
|
||||
if PlayersSellingWeed[source] then
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
local poochQuantity = xPlayer.getInventoryItem('weed_pooch').count
|
||||
|
||||
if poochQuantity == 0 then
|
||||
@@ -520,17 +439,15 @@ local function SellWeed(source)
|
||||
xPlayer.addAccountMoney('black_money', 180)
|
||||
TriggerClientEvent('esx:showNotification', source, _U('sold_one_weed'))
|
||||
end
|
||||
|
||||
|
||||
SellWeed(source)
|
||||
end
|
||||
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
RegisterServerEvent('esx_drugs:startSellWeed')
|
||||
AddEventHandler('esx_drugs:startSellWeed', function()
|
||||
|
||||
local _source = source
|
||||
|
||||
PlayersSellingWeed[_source] = true
|
||||
@@ -538,51 +455,42 @@ AddEventHandler('esx_drugs:startSellWeed', function()
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog'))
|
||||
|
||||
SellWeed(_source)
|
||||
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_drugs:stopSellWeed')
|
||||
AddEventHandler('esx_drugs:stopSellWeed', function()
|
||||
|
||||
local _source = source
|
||||
|
||||
PlayersSellingWeed[_source] = false
|
||||
|
||||
end)
|
||||
|
||||
|
||||
--opium
|
||||
|
||||
local function HarvestOpium(source)
|
||||
|
||||
if CopsConnected < Config.RequiredCopsOpium then
|
||||
TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsOpium))
|
||||
return
|
||||
end
|
||||
|
||||
SetTimeout(Config.TimeToFarm, function()
|
||||
|
||||
if PlayersHarvestingOpium[source] == true then
|
||||
|
||||
if PlayersHarvestingOpium[source] then
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
|
||||
local opium = xPlayer.getInventoryItem('opium')
|
||||
|
||||
if opium.limit ~= -1 and opium.count >= opium.limit then
|
||||
TriggerClientEvent('esx:showNotification', source, _U('inv_full_opium'))
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('inv_full_opium'))
|
||||
else
|
||||
xPlayer.addInventoryItem('opium', 1)
|
||||
HarvestOpium(source)
|
||||
HarvestOpium(_source)
|
||||
end
|
||||
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
RegisterServerEvent('esx_drugs:startHarvestOpium')
|
||||
AddEventHandler('esx_drugs:startHarvestOpium', function()
|
||||
|
||||
local _source = source
|
||||
|
||||
PlayersHarvestingOpium[_source] = true
|
||||
@@ -590,53 +498,45 @@ AddEventHandler('esx_drugs:startHarvestOpium', function()
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('pickup_in_prog'))
|
||||
|
||||
HarvestOpium(_source)
|
||||
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_drugs:stopHarvestOpium')
|
||||
AddEventHandler('esx_drugs:stopHarvestOpium', function()
|
||||
|
||||
local _source = source
|
||||
|
||||
PlayersHarvestingOpium[_source] = false
|
||||
|
||||
end)
|
||||
|
||||
local function TransformOpium(source)
|
||||
|
||||
if CopsConnected < Config.RequiredCopsOpium then
|
||||
TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsOpium))
|
||||
return
|
||||
end
|
||||
|
||||
SetTimeout(Config.TimeToProcess, function()
|
||||
|
||||
if PlayersTransformingOpium[source] == true then
|
||||
|
||||
if PlayersTransformingOpium[source] then
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
|
||||
local opiumQuantity = xPlayer.getInventoryItem('opium').count
|
||||
local poochQuantity = xPlayer.getInventoryItem('opium_pooch').count
|
||||
local pooch = xPlayer.getInventoryItem('opium_pooch')
|
||||
|
||||
if poochQuantity > 35 then
|
||||
TriggerClientEvent('esx:showNotification', source, _U('too_many_pouches'))
|
||||
if pooch.limit ~= -1 and pooch.count >= pooch.limit then
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('too_many_pouches'))
|
||||
elseif opiumQuantity < 5 then
|
||||
TriggerClientEvent('esx:showNotification', source, _U('not_enough_opium'))
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('not_enough_opium'))
|
||||
else
|
||||
xPlayer.removeInventoryItem('opium', 5)
|
||||
xPlayer.addInventoryItem('opium_pooch', 1)
|
||||
|
||||
TransformOpium(source)
|
||||
TransformOpium(_source)
|
||||
end
|
||||
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
RegisterServerEvent('esx_drugs:startTransformOpium')
|
||||
AddEventHandler('esx_drugs:startTransformOpium', function()
|
||||
|
||||
local _source = source
|
||||
|
||||
PlayersTransformingOpium[_source] = true
|
||||
@@ -644,32 +544,25 @@ AddEventHandler('esx_drugs:startTransformOpium', function()
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('packing_in_prog'))
|
||||
|
||||
TransformOpium(_source)
|
||||
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_drugs:stopTransformOpium')
|
||||
AddEventHandler('esx_drugs:stopTransformOpium', function()
|
||||
|
||||
local _source = source
|
||||
|
||||
PlayersTransformingOpium[_source] = false
|
||||
|
||||
end)
|
||||
|
||||
local function SellOpium(source)
|
||||
|
||||
if CopsConnected < Config.RequiredCopsOpium then
|
||||
TriggerClientEvent('esx:showNotification', source, _U('act_imp_police', CopsConnected, Config.RequiredCopsOpium))
|
||||
return
|
||||
end
|
||||
|
||||
SetTimeout(Config.TimeToSell, function()
|
||||
|
||||
if PlayersSellingOpium[source] == true then
|
||||
|
||||
if PlayersSellingOpium[source] then
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
local poochQuantity = xPlayer.getInventoryItem('opium_pooch').count
|
||||
|
||||
if poochQuantity == 0 then
|
||||
@@ -695,17 +588,15 @@ local function SellOpium(source)
|
||||
xPlayer.addAccountMoney('black_money', 1000)
|
||||
TriggerClientEvent('esx:showNotification', source, _U('sold_one_opium'))
|
||||
end
|
||||
|
||||
|
||||
SellOpium(source)
|
||||
end
|
||||
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
RegisterServerEvent('esx_drugs:startSellOpium')
|
||||
AddEventHandler('esx_drugs:startSellOpium', function()
|
||||
|
||||
local _source = source
|
||||
|
||||
PlayersSellingOpium[_source] = true
|
||||
@@ -713,33 +604,30 @@ AddEventHandler('esx_drugs:startSellOpium', function()
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('sale_in_prog'))
|
||||
|
||||
SellOpium(_source)
|
||||
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_drugs:stopSellOpium')
|
||||
AddEventHandler('esx_drugs:stopSellOpium', function()
|
||||
|
||||
local _source = source
|
||||
|
||||
PlayersSellingOpium[_source] = false
|
||||
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_drugs:GetUserInventory')
|
||||
AddEventHandler('esx_drugs:GetUserInventory', function(currentZone)
|
||||
local _source = source
|
||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||
TriggerClientEvent('esx_drugs:ReturnInventory',
|
||||
_source,
|
||||
xPlayer.getInventoryItem('coke').count,
|
||||
TriggerClientEvent('esx_drugs:ReturnInventory',
|
||||
_source,
|
||||
xPlayer.getInventoryItem('coke').count,
|
||||
xPlayer.getInventoryItem('coke_pooch').count,
|
||||
xPlayer.getInventoryItem('meth').count,
|
||||
xPlayer.getInventoryItem('meth_pooch').count,
|
||||
xPlayer.getInventoryItem('weed').count,
|
||||
xPlayer.getInventoryItem('weed_pooch').count,
|
||||
xPlayer.getInventoryItem('opium').count,
|
||||
xPlayer.getInventoryItem('meth').count,
|
||||
xPlayer.getInventoryItem('meth_pooch').count,
|
||||
xPlayer.getInventoryItem('weed').count,
|
||||
xPlayer.getInventoryItem('weed_pooch').count,
|
||||
xPlayer.getInventoryItem('opium').count,
|
||||
xPlayer.getInventoryItem('opium_pooch').count,
|
||||
xPlayer.job.name,
|
||||
xPlayer.job.name,
|
||||
currentZone
|
||||
)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user