local function checkMonsters(from, to)
local t = {}
for x = from.x, to.x do
for y = from.y, to.y do
for z = from.z, to.z do
local c = getTopCreature({x = x , y = y, z = z}).uid
if isMonster(c) then
table.insert(t, c)
end
end
end
end
return t
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
local check = checkMonsters({x = 100, y = 100, z = 7}, {x = 100, y = 100, z = 7}) -- monsters area
if #check >= 1 then
doPlayerSendCancel(cid, 'sorry you have to kill all monsters first')
else
doTeleportThing(cid, {x=100,y=100,z=7}) -- teleport room position
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
end
return true
end