• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Solved Auto refiller for old tibia [need help!]

wdvx

Sniper 7.4 War
Joined
Mar 5, 2013
Messages
263
Reaction score
14
I'm trying to create an auto-refiller when using items (such as food) but i'm stuck and need help.

LUA:
local MAX_FOOD = 1200

function onUse(cid, item, frompos, item2, topos)
	if (FOODS[item.itemid] == nil) then
		return FALSE
	end

	local size = FOODS[item.itemid][1]
	local sound = FOODS[item.itemid][2]

	if (getPlayerFood(cid) + size > MAX_FOOD) then
		doPlayerSendCancel(cid, "You are full.")
		return TRUE
	end
	
	doRemoveItem(item.uid, 1)

--[[ This part below this text ]] --
	
	local f = function()
		return doTransformItem(item.uid, item.itemid, getPlayerItemCount(cid, item.itemid) + 1)
	end
		
	if getPlayerItemCount(cid, item.itemid) < 100 then
		addEvent(f, 2000)
	end
	
	doPlayerFeed(cid, size)
	return TRUE
end

Console error:

item was not found

Appreciate every help!
 
Sorry for this unnecessary thread. I remember now that the item is deleted before it calls the timer ... = item does not exist!

Can be closed.
 
Back
Top