So I’m trying to make a “farm circle”(which is working) where the limit of farming is 500 of coke (in this case), but it always goes beyond 500. How can I change it to stop harvesting at 500? Any idea?
Thank you in advande!
–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)
local coke = xPlayer.getInventoryItem('coke')
if coke.limit == 500 and coke.count == coke.limit then
TriggerClientEvent('esx:showNotification', source, _U('inv_full_coke'))
else
xPlayer.addInventoryItem('coke', 1)
HarvestCoke(source)
end
end
end)
end