Nil compare attempt (probably caused by the new esx) HELP!

Hey!

I get an error by a comparison in a farming script.
It worked on fewer ESX, but on the new i think the tools or something are different.


local function HarvestKoda(source)

	SetTimeout(Config.TimeToFarm, function()
		if PlayersHarvestingKoda[source] then
			local xPlayer = ESX.GetPlayerFromId(source)
			local koda = xPlayer.getInventoryItem('banane')

			if koda.limit ~= -1 and koda.count >= koda.limit then
				TriggerClientEvent('esx:showNotification', source, _U('taschen_voll'))
			else
				xPlayer.addInventoryItem('banane', 1)
				HarvestKoda(source)
			end
		end
	end)
end

(ERROR: SCRIPT ERROR: @RV_bananen/server/main.lua:34: attempt to compare nil with number)

How do i have to change it?
Help would be great!

if koda.limit ~= -1 and koda.count >= koda.limit then

I would do some print statements to find out what’s going on with koda.limit and koda.count, once you find out which one(or maybe if both) are not populated, just work your way back in the code to find out where it’s supposed to be populating those values, whether the config file or db.

i already solved the problem

with the new esx version, you cannot use “.limit” anymore
its a new weight system you have to work with

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.