Ir para conteúdo

Featured Replies

Postado

Diga em poucas palavras a base utilizada (Nome do servidor ou nome do website).

TFS 0.4

Base: 

Dragon ball

 

 

Qual erro está surgindo/O que você procura?

To com um mode de "ARENA de sobrevivencia" aqueles que vão nascendo varios bixos por estagios, tem 10 estagios, esta funcionando tudo certo, nascem os bixos, eles morrem ja somem, entrando os itens tudo certo, mas quando você morre la dentro pros bixos aparece o primeiro erro ja, e o segundo erro é quando termina o evento ele te teleporta normal pra cidade da seu premio, mas aparece outro erro na distro

 

 

Você tem o código disponível? Se tiver publique-o aqui:

Erro quando você morre!

 

Spoiler

[19:17:29.238] [Error - CreatureScript Interface]
[19:17:29.238] function onStatsChange(cid, attacker, type, combat, value)
[19:17:29.239]                           domodlib('arena_config')
[19:17:29.239]   if isInRange(getPlayerPosition(cid), config.posicaoArena[1], config.posicaoArena[2]) then
[19:17:29.240]   if type == STATSCHANGE_HEALTHLOSS then
[19:17:29.240]    if isPlayer(cid) then
[19:17:29.241]                                                          if value >= getCreatureHealth(cid) then
[19:17:29.241]           doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)))
[19:17:29.242]           doPlayerSendTextMessage(pid,22,"You Died.")
[19:17:29.242]           doCreatureAddHealth(cid,getCreatureMaxHealth(cid) - getCreatureHealth(cid))
[19:17:29.242]          return false
[19:17:29.243]          end
[19:17:29.243]                                          end
[19:17:29.244]    end
[19:17:29.244]                          end
[19:17:29.245]                          return true

[19:17:29.246] end:onStatsChange
[19:17:29.248] Description:
[19:17:29.248] (luaDoPlayerSendTextMessage) Player not found

 

Erro quando termina o evento e são teleportado para o templo

 

Spoiler

[19:17:41.792] [Error - MoveEvents Interface]
[19:17:41.792] In a timer event called from:
[19:17:41.793] function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
[19:17:41.795]          domodlib('arena_config')
[19:17:41.796]                   if getPlayerAccess(cid) > config.acesso then doTeleportThing(cid, config.posicaoPlayer) return false end -- GM nao conta
[19:17:41.797]  doSetStorage(config.storage,getStorage(config.storage) - 1)
[19:17:41.797]  doTeleportThing(cid, config.posicaoPlayer)
[19:17:41.797]  registerCreatureEvent(cid, "naoAtacarPlayer")
[19:17:41.801]  registerCreatureEvent(cid, "morrerNaArena")
[19:17:41.801]  if getStorage(config.storage) <= 0 then
[19:17:41.802]  fecharTPeAguardarEvento()
[19:17:41.802]  end
[19:17:41.803]  return true

[19:17:41.805] end:onStepIn
[19:17:41.806] Description:
[19:17:41.806] (luaDoCleanTile) Tile not found

 

 

Você tem alguma imagem que possa auxiliar no problema? Se sim, coloque-a aqui.

Mod que to usando!

 

Spoiler

<?xml version="1.0" encoding="UTF-8"?>
<mod name="Arena" version="1.0" author="DrakyLucas" contact="XTibia" enabled="yes">
<config name="arena_config"><![CDATA[
  config = {
   delay = 120, -- tempo de um level para o outro
   posicaoPlayer = {x = 114,y = 579,z = 7}, -- posio q o player vai cair dps de entra no TP
   posicaoArena = {{x = 104,y = 568,z = 7},{x = 124,y = 590,z = 7}},
   premio = {
   {2160,100},
   {13654,100},
   {13655,100},
   }, -- ID, Quantidade... s aceita de 1 a 100 por vez, e voc pode adicionar quantos itens quiser.
   storage = 15444, -- no mecha..
   posicaoTp = {x = 169, y = 52, z = 7}, -- posicao que o teleporte vai aparecer
   acesso = 3, -- acesso  minimo para ser ignorado pelo evento, e o mesmo acesso para poder inicializa-lo
  }
  -- voc pode adicionar quantos leveis desejar
  -- [NumeroDoLevel] = {{"Nome",Quantidade},{"Nome",Quantidade},{"Nome",Quantidade},{"Nome",Quantidade},{"Nome",Quantidade}},
  leveis = {
  [1] = {{"Android1",8}},
  [2] = {{"Android2",6},{"android1",2}},
  [3] = {{"Android3",8}},
  [4] = {{"Android4",5},{"Android3",3}},
  [5] = {{"Android5",3},{"Android3",2},{"Android2",1}},
  [6] = {{"Android6",5},{"Android4",1},{"Android1",2}},
  [7] = {{"Android7",5},{"Android3",1},{"Android1",1}},
  [8] = {{"Android8",8}},
  [9] = {{"Android9",6},{"Android1",1},{"Android2",2}},
  [10] = {{"Android10",2},{"Android3",3},{"Android9",3}},
  }
  
   function abrirTeleport(n)
    doItemSetAttribute(doCreateItem(1387, config.posicaoTp), "aid", 2941) -- cria o tp e deixa aid 2941
    doBroadcastMessage("The arena Event will begin! teleport was open and missing ".. n .. " players for the event to start!")
    doSetStorage(config.storage, n)
   end
  
   function fecharTPeAguardarEvento()
    doRemoveItem(getTileItemById(config.posicaoTp, 1387).uid,100)
    doBroadcastMessage("The event already collusion " .. #getPlayersInArena() .. " and players will start " .. config.delay .. " seconds!")
    addEvent(evento,config.delay*1000,1)
   end
  
  
   function HaveCreatureArena(area, remove, clean) -- 
            for x = area[1].x - 1, area[2].x + 1 do
                for y = area[1].y - 1, area[2].y + 1 do
                    local pos = {x=x, y=y, z=area[1].z}
                    local m = getTopCreature(pos).uid
                    if remove ~= false and m ~= 0 and isMonster(m) then doRemoveCreature(m) end
                    if clean ~= false then doCleanTile(pos, false) end
                end
   end
   end
   function resetEvento()
    doSetStorage(config.storage, -1)
   end
  
   function criarMonstros(lv)
    local monstro = leveis[lv]
    local area = {config.posicaoArena[1],config.posicaoArena[2]}
    for i = 1,#monstro do
     for k=1,monstro[2]do
        pos = {x=math.random(area[1].x,area[2].x), y=math.random(area[1].y,area[2].y), z=area[1].z}
      monstrinho = doCreateMonster(monstro[1], pos)
      registerCreatureEvent(monstrinho, "removerCorpse")
     end
    end
   end
  
   function evento(i)
    if #getPlayersInArena() == 0 then
     doBroadcastMessage("All they died")
     doBroadcastMessage("End of the Event.")
     HaveCreatureArena({config.posicaoArena[1],config.posicaoArena[2]}, true, true) -- remove monstros, itens da arena
     resetEvento()
     return true
    end
  
    if i == (#leveis +1) then
    HaveCreatureArena({config.posicaoArena[1],config.posicaoArena[2]}, true, true)
      doBroadcastMessage("finalized event, " .. #getPlayersInArena() .. " They survived the event!")
     for _, pid in ipairs(getPlayersInArena()) do
      doPlayerSendTextMessage(pid,22,"Congratulations, you survived the event!")
      addItens(pid)
      doTeleportThing(pid,getTownTemplePosition(getPlayerTown(pid)))
     end
      resetEvento()
      return true
    end
     for _, pid  in ipairs(getPlayersInArena()) do
      doPlayerSendTextMessage(pid,22,"Lest Go Level " .. i .. " !!!")
     end
    criarMonstros(i)
    addEvent(evento,config.delay*1000,i+1)
   end
   function addItens(pid)
    for i=1,#config.premio do
     doPlayerAddItem(pid,config.premio[1],config.premio[2])
    end
    doPlayerSendTextMessage(pid,22,"Congratulations, you have received their prizes!")
   end
  
   function getPlayersInArena()
   local t = {}
    for _, pid in pairs(getPlayersOnline()) do
     if getPlayerAccess(pid) < config.acesso then
     if isInRange(getCreaturePosition(pid), config.posicaoArena[1], config.posicaoArena[2]) then
                        table.insert(t, pid)
     end
     end
    end
   return t
   end
  
]]></config>
<talkaction words="/arena" event="buffer"><![CDATA[
  domodlib('arena_config')
  if getPlayerAccess(cid) < config.acesso then
   return doPlayerSendCancel(cid,"Voce nao tem acesso para esse comando")
  end
  if tonumber(param) ~= nil then -- se o parametro  numerico
   if tonumber(param) > 0 then
    doSetStorage(config.storage, param)
    abrirTeleport(param)
   end
  else
  doPlayerSendTextMessage(cid,19,"Digite /arena e um numero.. \n exemplo: \n/arena 5")
  end

]]></talkaction>

<movevent type="StepIn" actionid="2941" event="script"><![CDATA[
        domodlib('arena_config')
             if getPlayerAccess(cid) > config.acesso then doTeleportThing(cid, config.posicaoPlayer) return false end -- GM nao conta
    doSetStorage(config.storage,getStorage(config.storage) - 1)
    doTeleportThing(cid, config.posicaoPlayer)
    registerCreatureEvent(cid, "naoAtacarPlayer")
    registerCreatureEvent(cid, "morrerNaArena")
    if getStorage(config.storage) <= 0 then
    fecharTPeAguardarEvento()
    end
    return true      
]]></movevent>
<event type="login" name="VerSeTaNaArenaEExpulsa" event="script"><![CDATA[
domodlib('arena_config')
if isInRange(getCreaturePosition(cid), config.posicaoArena[1], config.posicaoArena[2]) then
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
end
return true  
]]></event>
<event type="combat" name="naoAtacarPlayer" event="script"><![CDATA[
                 domodlib('arena_config')
                 if isPlayer(cid) and isPlayer(target) then
                       if isInRange(getPlayerPosition(cid), config.posicaoArena[1], config.posicaoArena[2]) and isInRange(getPlayerPosition(target), config.posicaoArena[1], config.posicaoArena[2]) then
                                doPlayerSendCancel(cid, "Do not attack your friends.")
                                return false
                        end
                end
                return true
]]></event>
<event type="death" name="removerCorpse" event="script"><![CDATA[
                 domodlib('arena_config')
     doCreatureSay(cid,"No one will have my loot! Buaahahahha",1)
     pos = getCreaturePosition(cid)
     addEvent(doCleanTile,1,pos, false)
                return true
]]></event>
<event type="statschange" name="morrerNaArena" event="script"><![CDATA[
                 domodlib('arena_config')
     if isInRange(getPlayerPosition(cid), config.posicaoArena[1], config.posicaoArena[2]) then
     if type == STATSCHANGE_HEALTHLOSS then
      if isPlayer(cid) then
                                if value >= getCreatureHealth(cid) then
         doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)))
         doPlayerSendTextMessage(pid,22,"You Died.")
         doCreatureAddHealth(cid,getCreatureMaxHealth(cid) - getCreatureHealth(cid))
        return false
        end
                        end
      end
                end
                return true
]]></event>
</mod>

 

       112674.gif

 

 

 

Postado
Spoiler

<?xml version="1.0" encoding="UTF-8"?>
<mod name="Arena" version="1.0" author="DrakyLucas" contact="XTibia" enabled="yes">
<config name="arena_config"><![CDATA[
  config = {
   delay = 120, -- tempo de um level para o outro
   posicaoPlayer = {x = 114,y = 579,z = 7}, -- posio q o player vai cair dps de entra no TP
   posicaoArena = {{x = 104,y = 568,z = 7},{x = 124,y = 590,z = 7}},
   premio = {
   {2160,100},
   {13654,100},
   {13655,100},
   }, -- ID, Quantidade... s aceita de 1 a 100 por vez, e voc pode adicionar quantos itens quiser.
   storage = 15444, -- no mecha..
   posicaoTp = {x = 169, y = 52, z = 7}, -- posicao que o teleporte vai aparecer
   acesso = 3, -- acesso  minimo para ser ignorado pelo evento, e o mesmo acesso para poder inicializa-lo
  }
  -- voc pode adicionar quantos leveis desejar
  -- [NumeroDoLevel] = {{"Nome",Quantidade},{"Nome",Quantidade},{"Nome",Quantidade},{"Nome",Quantidade},{"Nome",Quantidade}},
  leveis = {
  [1] = {{"Android1",8}},
  [2] = {{"Android2",6},{"android1",2}},
  [3] = {{"Android3",8}},
  [4] = {{"Android4",5},{"Android3",3}},
  [5] = {{"Android5",3},{"Android3",2},{"Android2",1}},
  [6] = {{"Android6",5},{"Android4",1},{"Android1",2}},
  [7] = {{"Android7",5},{"Android3",1},{"Android1",1}},
  [8] = {{"Android8",8}},
  [9] = {{"Android9",6},{"Android1",1},{"Android2",2}},
  [10] = {{"Android10",2},{"Android3",3},{"Android9",3}},
  }
  
  function isAllowedArenaPos(pos)
    if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then
        return false
    elseif isCreature(getTopCreature(pos).uid) then
        return false
    elseif getTileInfo(pos).protection then
        return false
    elseif hasProperty(getThingFromPos(pos).uid, 3) or hasProperty(getThingFromPos(pos).uid, 7) then
        return false
    end
    return true
end
  
   function abrirTeleport(n)
    doItemSetAttribute(doCreateItem(1387, config.posicaoTp), "aid", 2941) -- cria o tp e deixa aid 2941
    doBroadcastMessage("The arena Event will begin! teleport was open and missing ".. n .. " players for the event to start!")
    doSetStorage(config.storage, n)
   end
  
   function fecharTPeAguardarEvento()
    doRemoveItem(getTileItemById(config.posicaoTp, 1387).uid,100)
    doBroadcastMessage("The event already collusion " .. #getPlayersInArena() .. " and players will start " .. config.delay .. " seconds!")
    addEvent(evento,config.delay*1000,1)
   end
  
  
   function HaveCreatureArena(area, remove, clean) -- 
        for x = area[1].x - 1, area[2].x + 1 do
            for y = area[1].y - 1, area[2].y + 1 do
                local pos = {x=x, y=y, z=area[1].z}
                local m = getTopCreature(pos).uid
                if remove ~= false and m ~= 0 and isMonster(m) then doRemoveCreature(m) end
                if clean ~= false then 
                    if isAllowedArenaPos(pos) then
                        doCleanTile(pos, false)
                    end
                end
            end
        end
   end
   
   function resetEvento()
    doSetStorage(config.storage, -1)
   end
  
   function criarMonstros(lv)
    local monstro = leveis[lv]
    local area = {config.posicaoArena[1],config.posicaoArena[2]}
    for i = 1,#monstro do
     for k=1,monstro[2]do
        pos = {x=math.random(area[1].x,area[2].x), y=math.random(area[1].y,area[2].y), z=area[1].z}
      monstrinho = doCreateMonster(monstro[1], pos)
      registerCreatureEvent(monstrinho, "removerCorpse")
     end
    end
   end
  
   function evento(i)
    if #getPlayersInArena() == 0 then
     doBroadcastMessage("All they died")
     doBroadcastMessage("End of the Event.")
     HaveCreatureArena({config.posicaoArena[1],config.posicaoArena[2]}, true, true) -- remove monstros, itens da arena
     resetEvento()
     return true
    end
  
    if i == (#leveis +1) then
    HaveCreatureArena({config.posicaoArena[1],config.posicaoArena[2]}, true, true)
      doBroadcastMessage("finalized event, " .. #getPlayersInArena() .. " They survived the event!")
     for _, pid in ipairs(getPlayersInArena()) do
      doPlayerSendTextMessage(pid,22,"Congratulations, you survived the event!")
      addItens(pid)
      doTeleportThing(pid,getTownTemplePosition(getPlayerTown(pid)))
     end
      resetEvento()
      return true
    end
     for _, pid  in ipairs(getPlayersInArena()) do
      doPlayerSendTextMessage(pid,22,"Lest Go Level " .. i .. " !!!")
     end
    criarMonstros(i)
    addEvent(evento,config.delay*1000,i+1)
   end
   function addItens(pid)
    for i=1,#config.premio do
     doPlayerAddItem(pid,config.premio[1],config.premio[2])
    end
    doPlayerSendTextMessage(pid,22,"Congratulations, you have received their prizes!")
   end
  
   function getPlayersInArena()
   local t = {}
    for _, pid in pairs(getPlayersOnline()) do
     if getPlayerAccess(pid) < config.acesso then
     if isInRange(getCreaturePosition(pid), config.posicaoArena[1], config.posicaoArena[2]) then
                        table.insert(t, pid)
     end
     end
    end
   return t
   end
  
]]></config>
<talkaction words="/arena" event="buffer"><![CDATA[
  domodlib('arena_config')
  if getPlayerAccess(cid) < config.acesso then
   return doPlayerSendCancel(cid,"Voce nao tem acesso para esse comando")
  end
  if tonumber(param) ~= nil then -- se o parametro  numerico
   if tonumber(param) > 0 then
    doSetStorage(config.storage, param)
    abrirTeleport(param)
   end
  else
  doPlayerSendTextMessage(cid,19,"Digite /arena e um numero.. \n exemplo: \n/arena 5")
  end

]]></talkaction>

<movevent type="StepIn" actionid="2941" event="script"><![CDATA[
    domodlib('arena_config')
    if getPlayerAccess(cid) > config.acesso then doTeleportThing(cid, config.posicaoPlayer) return false end -- GM nao conta
        doSetStorage(config.storage,getStorage(config.storage) - 1)
        doTeleportThing(cid, config.posicaoPlayer)
        registerCreatureEvent(cid, "naoAtacarPlayer")
        registerCreatureEvent(cid, "morrerNaArena")
        if getStorage(config.storage) <= 0 then
            fecharTPeAguardarEvento()
        end
    return true      
]]></movevent>
<event type="login" name="VerSeTaNaArenaEExpulsa" event="script"><![CDATA[
domodlib('arena_config')
if isInRange(getCreaturePosition(cid), config.posicaoArena[1], config.posicaoArena[2]) then
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
end
return true  
]]></event>
<event type="combat" name="naoAtacarPlayer" event="script"><![CDATA[
                 domodlib('arena_config')
                 if isPlayer(cid) and isPlayer(target) then
                       if isInRange(getPlayerPosition(cid), config.posicaoArena[1], config.posicaoArena[2]) and isInRange(getPlayerPosition(target), config.posicaoArena[1], config.posicaoArena[2]) then
                                doPlayerSendCancel(cid, "Do not attack your friends.")
                                return false
                        end
                end
                return true
]]></event>
<event type="death" name="removerCorpse" event="script"><![CDATA[
                 domodlib('arena_config')
     doCreatureSay(cid,"No one will have my loot! Buaahahahha",1)
     pos = getCreaturePosition(cid)
     addEvent(doCleanTile,1,pos, false)
                return true
]]></event>
<event type="statschange" name="morrerNaArena" event="script"><![CDATA[
                 domodlib('arena_config')
     if isInRange(getPlayerPosition(cid), config.posicaoArena[1], config.posicaoArena[2]) then
     if type == STATSCHANGE_HEALTHLOSS then
      if isPlayer(cid) then
                                if value >= getCreatureHealth(cid) then
         doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)))
         doPlayerSendTextMessage(cid,22,"You Died.")
         doCreatureAddHealth(cid,getCreatureMaxHealth(cid) - getCreatureHealth(cid))
        return false
        end
                        end
      end
                end
                return true
]]></event>
</mod>

 

 

Contato:

 

Postado
  • Autor
6 minutos atrás, Dwarfer disse:
  Ocultar conteúdo


<?xml version="1.0" encoding="UTF-8"?>
<mod name="Arena" version="1.0" author="DrakyLucas" contact="XTibia" enabled="yes">
<config name="arena_config"><![CDATA[
  config = {
   delay = 120, -- tempo de um level para o outro
   posicaoPlayer = {x = 114,y = 579,z = 7}, -- posio q o player vai cair dps de entra no TP
   posicaoArena = {{x = 104,y = 568,z = 7},{x = 124,y = 590,z = 7}},
   premio = {
   {2160,100},
   {13654,100},
   {13655,100},
   }, -- ID, Quantidade... s aceita de 1 a 100 por vez, e voc pode adicionar quantos itens quiser.
   storage = 15444, -- no mecha..
   posicaoTp = {x = 169, y = 52, z = 7}, -- posicao que o teleporte vai aparecer
   acesso = 3, -- acesso  minimo para ser ignorado pelo evento, e o mesmo acesso para poder inicializa-lo
  }
  -- voc pode adicionar quantos leveis desejar
  -- [NumeroDoLevel] = {{"Nome",Quantidade},{"Nome",Quantidade},{"Nome",Quantidade},{"Nome",Quantidade},{"Nome",Quantidade}},
  leveis = {
  [1] = {{"Android1",8}},
  [2] = {{"Android2",6},{"android1",2}},
  [3] = {{"Android3",8}},
  [4] = {{"Android4",5},{"Android3",3}},
  [5] = {{"Android5",3},{"Android3",2},{"Android2",1}},
  [6] = {{"Android6",5},{"Android4",1},{"Android1",2}},
  [7] = {{"Android7",5},{"Android3",1},{"Android1",1}},
  [8] = {{"Android8",8}},
  [9] = {{"Android9",6},{"Android1",1},{"Android2",2}},
  [10] = {{"Android10",2},{"Android3",3},{"Android9",3}},
  }
  
  function isAllowedArenaPos(pos)
    if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then
        return false
    elseif isCreature(getTopCreature(pos).uid) then
        return false
    elseif getTileInfo(pos).protection then
        return false
    elseif hasProperty(getThingFromPos(pos).uid, 3) or hasProperty(getThingFromPos(pos).uid, 7) then
        return false
    end
    return true
end
  
   function abrirTeleport(n)
    doItemSetAttribute(doCreateItem(1387, config.posicaoTp), "aid", 2941) -- cria o tp e deixa aid 2941
    doBroadcastMessage("The arena Event will begin! teleport was open and missing ".. n .. " players for the event to start!")
    doSetStorage(config.storage, n)
   end
  
   function fecharTPeAguardarEvento()
    doRemoveItem(getTileItemById(config.posicaoTp, 1387).uid,100)
    doBroadcastMessage("The event already collusion " .. #getPlayersInArena() .. " and players will start " .. config.delay .. " seconds!")
    addEvent(evento,config.delay*1000,1)
   end
  
  
   function HaveCreatureArena(area, remove, clean) -- 
        for x = area[1].x - 1, area[2].x + 1 do
            for y = area[1].y - 1, area[2].y + 1 do
                local pos = {x=x, y=y, z=area[1].z}
                local m = getTopCreature(pos).uid
                if remove ~= false and m ~= 0 and isMonster(m) then doRemoveCreature(m) end
                if clean ~= false then 
                    if isAllowedArenaPos(pos) then
                        doCleanTile(pos, false)
                    end
                end
            end
        end
   end
   
   function resetEvento()
    doSetStorage(config.storage, -1)
   end
  
   function criarMonstros(lv)
    local monstro = leveis[lv]
    local area = {config.posicaoArena[1],config.posicaoArena[2]}
    for i = 1,#monstro do
     for k=1,monstro[2]do
        pos = {x=math.random(area[1].x,area[2].x), y=math.random(area[1].y,area[2].y), z=area[1].z}
      monstrinho = doCreateMonster(monstro[1], pos)
      registerCreatureEvent(monstrinho, "removerCorpse")
     end
    end
   end
  
   function evento(i)
    if #getPlayersInArena() == 0 then
     doBroadcastMessage("All they died")
     doBroadcastMessage("End of the Event.")
     HaveCreatureArena({config.posicaoArena[1],config.posicaoArena[2]}, true, true) -- remove monstros, itens da arena
     resetEvento()
     return true
    end
  
    if i == (#leveis +1) then
    HaveCreatureArena({config.posicaoArena[1],config.posicaoArena[2]}, true, true)
      doBroadcastMessage("finalized event, " .. #getPlayersInArena() .. " They survived the event!")
     for _, pid in ipairs(getPlayersInArena()) do
      doPlayerSendTextMessage(pid,22,"Congratulations, you survived the event!")
      addItens(pid)
      doTeleportThing(pid,getTownTemplePosition(getPlayerTown(pid)))
     end
      resetEvento()
      return true
    end
     for _, pid  in ipairs(getPlayersInArena()) do
      doPlayerSendTextMessage(pid,22,"Lest Go Level " .. i .. " !!!")
     end
    criarMonstros(i)
    addEvent(evento,config.delay*1000,i+1)
   end
   function addItens(pid)
    for i=1,#config.premio do
     doPlayerAddItem(pid,config.premio[1],config.premio[2])
    end
    doPlayerSendTextMessage(pid,22,"Congratulations, you have received their prizes!")
   end
  
   function getPlayersInArena()
   local t = {}
    for _, pid in pairs(getPlayersOnline()) do
     if getPlayerAccess(pid) < config.acesso then
     if isInRange(getCreaturePosition(pid), config.posicaoArena[1], config.posicaoArena[2]) then
                        table.insert(t, pid)
     end
     end
    end
   return t
   end
  
]]></config>
<talkaction words="/arena" event="buffer"><![CDATA[
  domodlib('arena_config')
  if getPlayerAccess(cid) < config.acesso then
   return doPlayerSendCancel(cid,"Voce nao tem acesso para esse comando")
  end
  if tonumber(param) ~= nil then -- se o parametro  numerico
   if tonumber(param) > 0 then
    doSetStorage(config.storage, param)
    abrirTeleport(param)
   end
  else
  doPlayerSendTextMessage(cid,19,"Digite /arena e um numero.. \n exemplo: \n/arena 5")
  end

]]></talkaction>

<movevent type="StepIn" actionid="2941" event="script"><![CDATA[
    domodlib('arena_config')
    if getPlayerAccess(cid) > config.acesso then doTeleportThing(cid, config.posicaoPlayer) return false end -- GM nao conta
        doSetStorage(config.storage,getStorage(config.storage) - 1)
        doTeleportThing(cid, config.posicaoPlayer)
        registerCreatureEvent(cid, "naoAtacarPlayer")
        registerCreatureEvent(cid, "morrerNaArena")
        if getStorage(config.storage) <= 0 then
            fecharTPeAguardarEvento()
        end
    return true      
]]></movevent>
<event type="login" name="VerSeTaNaArenaEExpulsa" event="script"><![CDATA[
domodlib('arena_config')
if isInRange(getCreaturePosition(cid), config.posicaoArena[1], config.posicaoArena[2]) then
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
end
return true  
]]></event>
<event type="combat" name="naoAtacarPlayer" event="script"><![CDATA[
                 domodlib('arena_config')
                 if isPlayer(cid) and isPlayer(target) then
                       if isInRange(getPlayerPosition(cid), config.posicaoArena[1], config.posicaoArena[2]) and isInRange(getPlayerPosition(target), config.posicaoArena[1], config.posicaoArena[2]) then
                                doPlayerSendCancel(cid, "Do not attack your friends.")
                                return false
                        end
                end
                return true
]]></event>
<event type="death" name="removerCorpse" event="script"><![CDATA[
                 domodlib('arena_config')
     doCreatureSay(cid,"No one will have my loot! Buaahahahha",1)
     pos = getCreaturePosition(cid)
     addEvent(doCleanTile,1,pos, false)
                return true
]]></event>
<event type="statschange" name="morrerNaArena" event="script"><![CDATA[
                 domodlib('arena_config')
     if isInRange(getPlayerPosition(cid), config.posicaoArena[1], config.posicaoArena[2]) then
     if type == STATSCHANGE_HEALTHLOSS then
      if isPlayer(cid) then
                                if value >= getCreatureHealth(cid) then
         doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)))
         doPlayerSendTextMessage(cid,22,"You Died.")
         doCreatureAddHealth(cid,getCreatureMaxHealth(cid) - getCreatureHealth(cid))
        return false
        end
                        end
      end
                end
                return true
]]></event>
</mod>

 

 

 

 

Apareceu esse erro, e não nasceu nenhum monstro !

 

Spoiler

[19:45:32.048] [Error - MoveEvents Interface]
[19:45:32.051] In a timer event called from:
[19:45:32.052] function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
[19:45:32.052] domodlib('arena_config')
[19:45:32.053]     if getPlayerAccess(cid) > config.acesso then doTeleportThing(cid, config.posicaoPlayer) return false end -- GM nao conta
[19:45:32.054]         doSetStorage(config.storage,getStorage(config.storage) - 1)
[19:45:32.055]         doTeleportThing(cid, config.posicaoPlayer)
[19:45:32.057]         registerCreatureEvent(cid, "naoAtacarPlayer")
[19:45:32.058]         registerCreatureEvent(cid, "morrerNaArena")
[19:45:32.058]         if getStorage(config.storage) <= 0 then
[19:45:32.059]             fecharTPeAguardarEvento()
[19:45:32.060]         end
[19:45:32.061]     return true

[19:45:32.063] end:onStepIn
[19:45:32.067] Description:
[19:45:32.069] [string "config = {..."]:78: 'for' limit must be a number
[19:45:32.070] stack traceback:
[19:45:32.071]  [string "config = {..."]:78: in function 'criarMonstros'
[19:45:32.072]  [string "config = {..."]:109: in function <[string "config = {..."]:86>

 

       112674.gif

 

 

 

Postado
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Arena" version="1.0" author="DrakyLucas" contact="XTibia" enabled="yes">
<config name="arena_config"><![CDATA[
  config = {
   delay = 120, -- tempo de um level para o outro
   posicaoPlayer = {x = 114,y = 579,z = 7}, -- posio q o player vai cair dps de entra no TP
   posicaoArena = {{x = 104,y = 568,z = 7},{x = 124,y = 590,z = 7}},
   premio = {
   {2160,100},
   {13654,100},
   {13655,100},
   }, -- ID, Quantidade... s aceita de 1 a 100 por vez, e voc pode adicionar quantos itens quiser.
   storage = 16445, -- no mecha..
   posicaoTp = {x = 169, y = 52, z = 7}, -- posicao que o teleporte vai aparecer
   acesso = 3, -- acesso  minimo para ser ignorado pelo evento, e o mesmo acesso para poder inicializa-lo
  }
  -- voc pode adicionar quantos leveis desejar
  -- [NumeroDoLevel] = {{"Nome",Quantidade},{"Nome",Quantidade},{"Nome",Quantidade},{"Nome",Quantidade},{"Nome",Quantidade}},
  leveis = {
  [1] = {{"Android1",8}},
  [2] = {{"Android2",6},{"android1",2}},
  [3] = {{"Android3",8}},
  [4] = {{"Android4",5},{"Android3",3}},
  [5] = {{"Android5",3},{"Android3",2},{"Android2",1}},
  [6] = {{"Android6",5},{"Android4",1},{"Android1",2}},
  [7] = {{"Android7",5},{"Android3",1},{"Android1",1}},
  [8] = {{"Android8",8}},
  [9] = {{"Android9",6},{"Android1",1},{"Android2",2}},
  [10] = {{"Android10",2},{"Android3",3},{"Android9",3}},
  }
  
   function abrirTeleport(n)
    doItemSetAttribute(doCreateItem(1387, config.posicaoTp), "aid", 2941) -- cria o tp e deixa aid 2941
    doBroadcastMessage("The arena Event will begin! teleport was open and missing ".. n .. " players for the event to start!")
    doSetStorage(config.storage, n)
   end
  
   function fecharTPeAguardarEvento()
    doRemoveItem(getTileItemById(config.posicaoTp, 1387).uid,100)
    doBroadcastMessage("The event already collusion " .. #getPlayersInArena() .. " and players will start " .. config.delay .. " seconds!")
    addEvent(evento,config.delay*1000,1)
   end
  
  
   function HaveCreatureArena(area, remove, clean) -- 
            for x = area[1].x - 1, area[2].x + 1 do
                for y = area[1].y - 1, area[2].y + 1 do
                    local pos = {x=x, y=y, z=area[1].z}
                    local m = getTopCreature(pos).uid
                    if remove ~= false and m ~= 0 and isMonster(m) then doRemoveCreature(m) end
                    if clean ~= false then doCleanTile(pos, false) end
                end
   end
   end
   function resetEvento()
    doSetStorage(config.storage, -1)
   end
  
   function criarMonstros(lv)
    local monstro = leveis[lv]
    local area = {config.posicaoArena[1],config.posicaoArena[2]}
    for i = 1,#monstro do
     for k=1,monstro[2]do
        pos = {x=math.random(area[1].x,area[2].x), y=math.random(area[1].y,area[2].y), z=area[1].z}
      monstrinho = doCreateMonster(monstro[1], pos)
      registerCreatureEvent(monstrinho, "removerCorpse")
     end
    end
   end
  
   function evento(i)
    if #getPlayersInArena() == 0 then
     doBroadcastMessage("All they died")
     doBroadcastMessage("End of the Event.")
     HaveCreatureArena({config.posicaoArena[1],config.posicaoArena[2]}, true, true) -- remove monstros, itens da arena
     resetEvento()
     return true
    end
  
    if i == (#leveis +1) then
    HaveCreatureArena({config.posicaoArena[1],config.posicaoArena[2]}, true, true)
      doBroadcastMessage("finalized event, " .. #getPlayersInArena() .. " They survived the event!")
     for _, pid in ipairs(getPlayersInArena()) do
      doPlayerSendTextMessage(pid,22,"Congratulations, you survived the event!")
      addItens(pid)
      doTeleportThing(pid,getTownTemplePosition(getPlayerTown(pid)))
     end
      resetEvento()
      return true
    end
     for _, pid  in ipairs(getPlayersInArena()) do
      doPlayerSendTextMessage(pid,22,"Lest Go Level " .. i .. " !!!")
     end
    criarMonstros(i)
    addEvent(evento,config.delay*1000,i+1)
   end
   function addItens(pid)
    for i=1,#config.premio do
     doPlayerAddItem(pid,config.premio[1],config.premio[2])
    end
    doPlayerSendTextMessage(pid,22,"Congratulations, you have received their prizes!")
   end
  
   function getPlayersInArena()
   local t = {}
    for _, pid in pairs(getPlayersOnline()) do
     if getPlayerAccess(pid) < config.acesso then
     if isInRange(getCreaturePosition(pid), config.posicaoArena[1], config.posicaoArena[2]) then
                        table.insert(t, pid)
     end
     end
    end
   return t
   end
  
]]></config>
<talkaction words="/arena" event="buffer"><![CDATA[
  domodlib('arena_config')
  if getPlayerAccess(cid) < config.acesso then
   return doPlayerSendCancel(cid,"Voce nao tem acesso para esse comando")
  end
  if tonumber(param) ~= nil then -- se o parametro  numerico
   if tonumber(param) > 0 then
    doSetStorage(config.storage, param)
    abrirTeleport(param)
   end
  else
  doPlayerSendTextMessage(cid,19,"Digite /arena e um numero.. \n exemplo: \n/arena 5")
  end

]]></talkaction>

<movevent type="StepIn" actionid="2941" event="script"><![CDATA[
        domodlib('arena_config')
             if getPlayerAccess(cid) > config.acesso then doTeleportThing(cid, config.posicaoPlayer) return false end -- GM nao conta
    doSetStorage(config.storage,getStorage(config.storage) - 1)
    doTeleportThing(cid, config.posicaoPlayer)
    registerCreatureEvent(cid, "naoAtacarPlayer")
    registerCreatureEvent(cid, "morrerNaArena")
    if getStorage(config.storage) <= 0 then
    fecharTPeAguardarEvento()
    end
    return true      
]]></movevent>
<event type="login" name="VerSeTaNaArenaEExpulsa" event="script"><![CDATA[
domodlib('arena_config')
if isInRange(getCreaturePosition(cid), config.posicaoArena[1], config.posicaoArena[2]) then
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
end
return true  
]]></event>
<event type="combat" name="naoAtacarPlayer" event="script"><![CDATA[
                 domodlib('arena_config')
                 if isPlayer(cid) and isPlayer(target) then
                       if isInRange(getPlayerPosition(cid), config.posicaoArena[1], config.posicaoArena[2]) and isInRange(getPlayerPosition(target), config.posicaoArena[1], config.posicaoArena[2]) then
                                doPlayerSendCancel(cid, "Do not attack your friends.")
                                return false
                        end
                end
                return true
]]></event>
<event type="death" name="removerCorpse" event="script"><![CDATA[
domodlib('arena_config')
doCreatureSay(cid,"No one will have my loot! Buaahahahha",1)
pos = getCreaturePosition(cid)
addEvent(doCleanTile, 1 , pos, false)
return true
]]></event>
<event type="preparedeath" name="morrerNaArena" event="script"><![CDATA[
domodlib('arena_config')
function onPrepareDeath(cid, killers)
	if isInRange(getPlayerPosition(cid), config.posicaoArena[1], config.posicaoArena[2]) then
		doCreatureAddHealth(cid, getCreatureMaxHealth(cid), 65535, 256, true)
		doRemoveConditions(cid, false)
		doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
		doPlayerSendTextMessage(cid,22,"You Died.")
		return false
	end
	return true
end]]></event>
</mod>

 

vodkart_logo.png

[*Ninguém será digno do sucesso se não usar suas derrotas para conquistá-lo.*]

 

DISCORDvodkart#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.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo