RenegadeThePox
New Member
- Joined
- Oct 7, 2007
- Messages
- 62
- Reaction score
- 2
Hello, im using TFS 1.2 By Nekiro(Tibia 8.6), when i try to use a weapon on itens like crates, barrels, chairs, etc. it don't destroy...
Does anyone know why all items return 0?
Thanks.
Lua:
function destroyItem(player, target, toPosition)
if type(target) ~= "userdata" or not target:isItem() then
return false
end
if target:hasAttribute(ITEM_ATTRIBUTE_UNIQUEID) or target:hasAttribute(ITEM_ATTRIBUTE_ACTIONID) then
return false
end
if toPosition.x == CONTAINER_POSITION then
player:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
return true
end
local destroyId = ItemType(target.itemid):getDestroyId()
if destroyId == 0 then
return false
end
if math.random(7) == 1 then
local item = Game.createItem(destroyId, 1, toPosition)
if item then
item:decay()
end
-- Move items outside the container
if target:isContainer() then
for i = target:getSize() - 1, 0, -1 do
local containerItem = target:getItem(i)
if containerItem then
containerItem:moveTo(toPosition)
end
end
end
target:remove(1)
end
toPosition:sendMagicEffect(CONST_ME_POFF)
return true
end
local destroyId = ItemType(target.itemid):getDestroyId()
if destroyId == 0 then
return false
end
Does anyone know why all items return 0?
Thanks.