Postado Outubro 30, 2017 7 anos Autor . Editado Outubro 31, 2017 7 anos por OfWar (veja o histórico de edições)
Postado Outubro 31, 2017 7 anos Autor @Dwarfer Funcionouu mt obg, só que eu queria resolver isso \/ O player mata o Arenator pega o prêmio e sai Quest normal, ai dps de 1 minuto seja aonde ele tiver, ele toma teleport pra saída da quest Editado Outubro 31, 2017 7 anos por OfWar (veja o histórico de edições)
Postado Outubro 31, 2017 7 anos Sim, não coloquei a verificação porque me baseei pela foto que você colocou da área. Achei que o único jeito que o player poderia sair seria sendo kikado da área. Utilize essa: Spoiler local t = { level = 100, key = {id = 1111, remove = "yes"}, -- id da chave, "yes" para remover, "no" para não remover area = {{x=1,y=1,z=1}, {x=1,y=1,z=1}}, -- posição do canto superior esquerdo, inferior direito da área arenaPos = {x=1,y=1,z=1}, -- posição para qual o player será teleportado ao entrar monster = {"Demon", {x=1,y=1,z=1}}, -- posição que o monstro aparecerá kick = {{1, "min"}, {x=1,y=1,z=1}} -- tempo para kikar o player da arena, posição para qual irá quando for kikado } function onUse(cid, item, fromPosition, itemEx, toPosition) local p, timetoagain = getPlayerPosition(cid), getPlayerStorageValue(cid, 87932) - os.time() if timetoagain > 0 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You need wait ".. timetoagain .. " seconds to pass again.") doSendMagicEffect(p, CONST_ME_POFF) return true end if getPlayerLevel(cid) < t.level then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Only players level " .. t.level.. " or higher can pass.") doSendMagicEffect(p, CONST_ME_POFF) return true end if getPlayerItemCount(cid, t.key.id) == 0 then local key = getItemNameById(t.key.id) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You need ".. getArticle(key) .. " " .. key .. " to pass.") doSendMagicEffect(p, CONST_ME_POFF) return true end local players = getPlayersInArea(t.area[1], t.area[2]) if #players > 0 then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Somebody is inside the arena.") doSendMagicEffect(p, CONST_ME_POFF) return true end local monstersInArea = getMonstersInArea(t.area[1], t.area[2]) if #monstersInArea > 0 then for i = 1, #monstersInArea do doRemoveCreature(monstersInArea[i]) end end if t.key.remove == "yes" then doPlayerRemoveItem(cid, t.key.id, 1) end local monster = doCreateMonster(t.monster[1], t.monster[2]) setPlayerStorageValue(cid, 87932, mathtime(t.kick[1])+1+os.time()) doTeleportThing(cid, t.arenaPos) doSendMagicEffect(t.arenaPos, CONST_ME_TELEPORT) doCreatureSay(cid, "You will have " .. t.kick[1][1] .. " " .. t.kick[1][2] .. " to kill the " .. t.monster[1] .. "!", TALKTYPE_ORANGE_1) addEvent(kickFromArena, mathtime(t.kick[1]) * 1000, cid, monster) return true end function kickFromArena(cid, monster) local check = true if isMonster(monster) then doRemoveCreature(monster) check = false end if isPlayer(cid) and isInRange(getPlayerPosition(cid), t.area[1], t.area[2]) then doTeleportThing(cid, t.kick[2]) doSendMagicEffect(t.kick[2], CONST_ME_TELEPORT) if check == false then doCreatureSay(cid, "Your time is over!", TALKTYPE_ORANGE_1) else doCreatureSay(cid, "Congratulations! You killed the " .. t.monster[1].. ".", TALKTYPE_ORANGE_1) end 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 mathtime(table) -- by dwarfer local unit = {"sec", "min", "hour", "day"} for i, v in pairs(unit) do if v == table[2] then return table[1]*(60^(v == unit[4] and 2 or i-1))*(v == unit[4] and 24 or 1) end end return error("Bad declaration in mathtime function.") end function getMonstersInArea(fromPos, toPos) -- by dwarfer local monsters = {} for x = fromPos.x, toPos.x do for y = fromPos.y, toPos.y do local pos = {x = x, y = y, z = fromPos.z} local monster = getTopCreature(pos).uid if monster > 0 and isMonster(monster) then table.insert(monsters, monster) end end end return monsters end Contato: Email: [email protected] Discord: Dwarfer#2715
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.