Hey!
It's just a item that creates an item (id:289) if the ground tile is walkable. After this it shall be removed but nothing happens.
It does not work at all. I would be very grateful if somebody helps me.
It's just a item that creates an item (id:289) if the ground tile is walkable. After this it shall be removed but nothing happens.
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if isWalkable(toPosition, false, true, true) then
doCreateItem(289, 1, toPosition)
addEvent(doRemoveItem, 5000, getThingFromPos(toPosition).uid, 1)
end
return true
end
function isWalkable(pos, creature, proj, pz)-- by Nord
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
if getTopCreature(pos).uid > 0 and creature then return false end
if getTileInfo(pos).protection and pz then return false, true end
local n = not proj and 3 or 2
for i = 0, 255 do
pos.stackpos = i
local tile = getTileThingByPos(pos)
if tile.itemid ~= 0 and not isCreature(tile.uid) then
if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
return false
end
end
end
return true
end
It does not work at all. I would be very grateful if somebody helps me.