T
Tibia Demon
Guest
i am trying to make this script remove wall by click wall its self but it remove all walls not the one i am clicking
it work weird too it remove wall if i stay in some positions and dont remove them on other positions idk what i have wrong
it work weird too it remove wall if i stay in some positions and dont remove them on other positions idk what i have wrong
Lua:
local walls = {
[1] = {pos = Position(1009, 1014, 7), wallid = 8475},
[2] = {pos = Position(1007, 1021, 7), wallid = 8476}
}
local wallaid = 4498
local wallremove = Action()
function wallremove.onUse(player, item, fromPosition, target, toPosition, isHotkey)
for v, k in pairs(walls) do
local tile = Tile(k.pos)
if not tile then
return true
end
local wall = tile:getItemById(k.wallid)
if wall and wall:getActionId() == wallaid then
wall:remove()
fromPosition:sendMagicEffect(CONST_ME_POFF)
end
end
return true
end
wallremove:aid(wallaid)
wallremove:register()