Postado Dezembro 26, 2014 10 anos Autor ... Editado Maio 2, 2015 10 anos por williamcgv (veja o histórico de edições)
Postado Dezembro 26, 2014 10 anos function isOnSameFloor(fromPos, toPos) return fromPos.z == toPos.z and true or false end function isEven(arg) return arg % 2 == 0 and true or false end function getMiddlePos(fromPos, toPos) if not isOnSameFloor(fromPos, toPos) then return false end local middle = {x = 0, y = 0, z = 0} middle.x = isEven(fromPos.x + toPos.x) and (fromPos.x + toPos.x)/2 or math.floor((fromPos.x + toPos.x)/2) + 1 middle.y = isEven(fromPos.y + toPos.y) and (fromPos.y + toPos.y)/2 or math.floor((fromPos.y + toPos.y)/2) + 1 middle.z = fromPos.z or toPos.z return middle end function getDistanceRadius(fromPos, toPos) if not isOnSameFloor(fromPos, toPos) then return false end local distance = getDistanceBetween(fromPos, toPos) return isEven(distance) and (distance/2) or math.floor(distance/2) + 1 end function clearArea(middlePos, rangex, rangey) local final = {x=1126, y=1152, z=7} -- Posição onde será teleportado quando acabar o tempo for i = -rangex, rangex do for j = -rangey, rangey do pos = {x = middlePos.x + i, y = middlePos.y + j, z = middlePos.z} creature = getTopCreature(pos).uid if isMonster(creature) then doSendMagicEffect(getThingPos(creature), 14) doRemoveCreature(creature) elseif isPlayer(creature) then doSendMagicEffect(getThingPos(creature), 10) doTeleportThing(creature, final) end end end setGlobalStorageValue(sto, -1) return true end local t = { lvl = 100, entrada = { {x = 1125, y = 1152, z = 7} -- pos players }, saida = { {x = 1125, y = 1153, z = 8} -- pos para onde eles irão }, monstros = { {{x = 1121, y = 1153, z = 8}, "Demon"} -- defina pos dos montros e nomes } } function onUse(cid, item, fromPosition, itemEx, toPosition) local configure = { fromPos = {x=1121, y=1150, z=8}, -- posição superior esquerda do mapa, da area em que esta mapeado a area. toPos = {x=1129, y=1156, z=8}, -- posição inferior direita do mapa, da area em que esta mapeado a area. boss = "Demon" -- Aqui você bota o nome do monstro que você quer remover } local config = { position = {x=1126, y=1152, z=7}, -- Contagem position1 = {x=1121, y=1150, z=8}, -- Contagem position2 = {x=1121, y=1156, z=8}, -- Contagem position3 = {x=1129, y=1150, z=8}, -- Contagem position4 = {x=1129, y=1156, z=8}, -- Contagem fromPosition = {x=1121, y=1150, z=8}, toPosition = {x=1129, y=1156, z=8}, id = 1498, time = 1 -- tempo que o teleport ira sumir em minutos } local time = 60 local sto = 5973 local check = {} for _, k in ipairs(t.entrada) do local x = getTopCreature(k).uid if(x == 0 or isPlayer(x) and getPlayerLevel(x) < t.lvl) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Não tem 5 jogadores para quest ou os jogadores nos sqms não tem o level mínimo para a quest.") return true end if getGlobalStorageValue(sto) == 1 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Annihilaton está bloqueada. Aguarde até que seja liberada.") return true end table.insert(check, x) end for _, summon in pairs(t.monstros) do local creature = getTopCreature(summon[1]).uid doCreateMonster(summon[2], summon[1]) end for i, tid in ipairs(check) do doTeleportThing(tid, t.saida[i], false) doSendMagicEffect(t.saida[i], 10) doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945) end for i = 1,time do formula = time - 1*i addEvent(doSendAnimatedText, i*1000, config.position, formula, TEXTCOLOR_RED) addEvent(doSendAnimatedText, i*1000, config.position1, formula, TEXTCOLOR_RED) addEvent(doSendAnimatedText, i*1000, config.position2, formula, TEXTCOLOR_RED) addEvent(doSendAnimatedText, i*1000, config.position3, formula, TEXTCOLOR_RED) addEvent(doSendAnimatedText, i*1000, config.position4, formula, TEXTCOLOR_RED) end setGlobalStorageValue(sto, 1) local rx = getDistanceRadius(configure.fromPos, configure.toPos) addEvent(clearArea, config.time * 60 * 1000, getMiddlePos(configure.fromPos, configure.toPos), rx, rx) return true end Editado Dezembro 26, 2014 10 anos por Suicide (veja o histórico de edições) The corrupt fear us. The honest support us. The heroic join us.
Postado Dezembro 26, 2014 10 anos Autor ... Editado Maio 2, 2015 10 anos por williamcgv (veja o histórico de edições)
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.