Postado Maio 20, 2016 9 anos Solução local t = { lvl = 100, Time = 5, -- em minutos entrada = { {x = 710, y = 1420, z = 5}, -- pos players {x = 709, y = 1420, z = 5}, {x = 708, y = 1420, z = 5}, {x = 707, y = 1420, z = 5} }, saida = { {x = 710, y = 1420, z = 6}, -- pos para onde eles irão {x = 709, y = 1420, z = 6}, {x = 708, y = 1420, z = 6}, {x = 707, y = 1420, z = 6} }, monstros = { {{x = 707, y = 1418, z = 6}, "Demon"}, -- defina pos dos montros e nomes {{x = 709, y = 1418, z = 6}, "Demon"}, {{x = 708, y = 1422, z = 6}, "Demon"}, {{x = 710, y = 1422, z = 6}, "Demon"}, {{x = 712, y = 1420, z = 6}, "Hellfire Fighter"}, {{x = 713, y = 1420, z = 6}, "Hellfire Fighter"}, {{x = 711, y = 1420, z = 6}, "Ghazbaran"} } } function VarAnihiPlayer(cid) if not isCreature(cid) then return LUA_ERROR end if isInRange(getPlayerPosition(cid), t.saida[1], t.saida[#t.saida]) then doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) end end function getPlayersInArea(fromPos, toPos) local players = {} for _, pid in ipairs(getPlayersOnline()) do if isInRange(getPlayerPosition(pid), fromPos, toPos) then table.insert(players, pid) end end return players end function onUse(cid, item, fromPosition, itemEx, toPosition) local check = {} if #getPlayersInArea(t.saida[1], t.saida[#t.saida]) > 0 then doPlayerSendCancel(cid, 'Aguarde, tem jogadores fazendo a quest.') return true end for _, k in ipairs(t.entrada) do local x = getTopCreature(k).uid if(x == 0 or not isPlayer(x) or getPlayerLevel(x) < t.lvl) then doPlayerSendCancel(cid, 'Está faltando player ou alguém não possui level '..t.lvl..' ou mais.') return true end table.insert(check, x) end for _, summon in pairs(t.monstros) do local creature = getTopCreature(summon[1]).uid if(creature > 0 and not isPlayer(creature)) then doRemoveCreature(creature) end doCleanTile(summon[1]) doCreateMonster(summon[2], summon[1]) end for i, tid in ipairs(check) do doSendMagicEffect(t.entrada[i], CONST_ME_POFF) doTeleportThing(tid, t.saida[i], false) addEvent(VarAnihiPlayer, t.Time*60*1000, tid) doSendMagicEffect(t.saida[i], CONST_ME_ENERGYAREA) end doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945) return true end Editado Maio 20, 2016 9 anos por Vodkart (veja o histórico de edições) [*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*] DISCORD: vodkart#6090
Participe da conversa
Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.