Ir para conteúdo
  • 0

ERRO EM EVENTO DE /ARENA X


ikaroangelo

Pergunta

[Error - CreatureScript Interface]

[12/03/2014 18:14:32] buffer:onStatsChange

[12/03/2014 18:14:32] Description:

[12/03/2014 18:14:32] [string "loadBuffer"]:6: attempt to call global 'getCreatureHealth' (a nil value)

[12/03/2014 18:14:33] stack traceback:

[12/03/2014 18:14:33] [string "loadBuffer"]:6: in function <[string "loadBuffer"]:1>


E Esse também:



[12/03/2014 18:12:26] [Error - MoveEvents Interface]

[12/03/2014 18:12:26] In a timer event called from:

[12/03/2014 18:12:26] buffer:onStepIn

[12/03/2014 18:12:26] Description:

[12/03/2014 18:12:26] (luaRegisterCreatureEvent) Creature not found




alguém sabe como corrigir? dou 5 REP+

Editado por ikaroangelo
Link para o comentário
Compartilhar em outros sites

11 respostass a esta questão

Posts Recomendados

  • 0

<? Xml version = "1.0" encoding = "ISO-8859-1">


<mod name="Arena" version="1.0" author="DrakyLucas" contact="XTibia" enabled="yes">

<config name="arena_config"> <! [CDATA [

config = {

delay = 30, - tempo de hum nível parágrafo O Outro

posicaoPlayer = {x = 387, y = 25, z = 7}, - dps POSIÇÃO jogador qo Vai CAIR de Entra sem TP

posicaoArena = {{x = 380, y = 19, z = 7}, {x = 394, y = 32, z = 7}},

premio = {

{10127,1},

{10130,1},

}, - ID, QUANTIDADE ... então Aceita de uma uma Vez POR 100, e Você PODE adicionar quantos itens Quiser.

armazenamento = 15444, - Localidade: Não mecha ..

posicaoTp = {x = 243, y = 44, z = 7}, - POSIÇÃO Que o teleporte aparecer Vai

Acesso = 3, - Acesso minimo parágrafo Ser ignorado Pelo Evento, EO MESMO Acesso parágrafo Poder inicializa-lo

}

- Você. PODE adicionar quantos leveis desejar

- [NumeroDoLevel] = {{"Nome",Quantidade},{"Nome",Quantidade},{"Nome",Quantidade},{"Nome",Quantidade},{"Nome",Quantidade}},

leveis = {

[1] = {{"Morgaroth", 2}},

[2] = {{"Ghazbaran", 2}, {"Ferumbras", 2}},

[3] = {{"Infernatil", 2}},

[4] = {{"infernatlil", 1}, {"Ferumbras", 2}},

[5] = {{"Ghazbaran", 2}, {"Morgaroth", 2}, {"Ferumbras", 2}},

}


funcionar abrirTeleport (n)

doItemSetAttribute (doCreateItem (1387, config.posicaoTp), "ajuda", 2941) - cria o tp e Deixa ajuda 2941

doBroadcastMessage ("arena O Evento Comecar Vai! teletransportar FOI ABERTO e Faltam" .. n .. "PESSOAS Para O Evento iniciar!")

doSetStorage (config.storage, n)

final


funcionar fecharTPeAguardarEvento ()

doRemoveItem (getTileItemById (config.posicaoTp, 1387). uid, 100)

doBroadcastMessage ("O Evento ja concluiu" .. # getPlayersInArena () .. "players de e começará em" .. config.delay .. "SEGUNDOS!")

addEvent (Evento, config.delay * 1000,1)

final



função HaveCreatureArena (área, remover, limpar) - função fazer Vodkart

para x = área [1] x -. 1., a área [2] x + 1 fazer

para y = área [1] y -. 1., a área [2] y + 1 fazer

pos local = {x = x, y = y, z = área [1]. z}

m local = getTopCreature (pos). uid

se remover ~ = false e m ~ = 0 e isMonster (m), então doRemoveCreature (m) end

se ~ = false então doCleanTile (pos, false) end limpo

final

final

final

resetEvento função ()

doSetStorage (config.storage, -1)

final


criarMonstros função (lv)

monstro local = leveis [lv]

área local = {config.posicaoArena [1], config.posicaoArena [2]}

para i = 1, # monstro fazer

para k = 1, monstro [2] fazer

pos = {x = math.random (área [1]. x, a área [2]. x), y = math.random (área [1]. y, a área [2]. y), z = área [1 ]. z}

Monstrinho = doCreateMonster (monstro [1], pos)

registerCreatureEvent (Monstrinho, "removerCorpse")

final

final

final


Evento função (i)

se # getPlayersInArena () == 0 então

doBroadcastMessage ("Ninguem sobreviveu uma arena = /")

doBroadcastMessage ("O Evento acabou!")

HaveCreatureArena ({config.posicaoArena [1], config.posicaoArena [2]}, verdade, verdade) - remover Monstros, Itens da Arena

resetEvento ()

return true

final


se i == (# leveis +1) então

HaveCreatureArena ({config.posicaoArena [1], config.posicaoArena [2]}, verdade, verdade)

doBroadcastMessage ("Evento Finalizado" .. # getPlayersInArena () .. "sobreviveram AO Evento!")

por _, pid em ipairs (getPlayersInArena ()) fazer

doPlayerSendTextMessage (pid, 22, "Parabéns, Você. sobreviveu AO Evento!")

addItens (PID)

doTeleportThing (pid, getTownTemplePosition (getPlayerTown (PID)))

final

resetEvento ()

return true

final

por _, pid em ipairs (getPlayersInArena ()) fazer

doPlayerSendTextMessage (pid, 22, "Nivel" .. i .. "!")

final

criarMonstros (i)

addEvent (Evento, config.delay * 1000, i +1)

final

addItens função (PID)

para i = 1, # config.premio fazer

doPlayerAddItem (pid, config.premio [1], config.premio [2])

final

doPlayerSendTextMessage (pid, 22, "Parabéns, Você. recebeu SEUS premios!")

final


getPlayersInArena função ()

local, t = {}

por _, pid em pares (getPlayersOnline ()) fazer

se getPlayerAccess (pid) <config.acesso então

se isInRange (getCreaturePosition (PID), config.posicaoArena [1], config.posicaoArena [2]) então

table.insert (t, pid)

final

final

final

retornar t

final


]]> </ Config>

<talkaction words="/arena" event="buffer"> <! [CDATA [

domodlib ('arena_config')

se getPlayerAccess (cid) <config.acesso então

voltar doPlayerSendCancel (cid, "Você nao tem Acesso parágrafo ESSE Comando")

final

se tonumber (param) ~ = nil então - se o parametro E numerico

se tonumber (param)> 0, em seguida,

doSetStorage (config.storage, param)

abrirTeleport (param)

final

outro

doPlayerSendTextMessage (cid, 19, "Digite / Arena e hum numero .. \ n Exemplo: \ n / arena de 5")

final


]]> </ Talkaction>


<movevent type="StepIn" actionid="2941" event="script"> <! [CDATA [

domodlib ('arena_config')

se getPlayerAccess (cid)> config.acesso então 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")

se getStorage (config.storage) <= 0 então

fecharTPeAguardarEvento ()

final

return true

]]> </ Movevent>

<event type="login" name="VerSeTaNaArenaEExpulsa" event="script"> <! [CDATA [

domodlib ('arena_config')

se isInRange (getCreaturePosition (CID), config.posicaoArena [1], config.posicaoArena [2]) então

doTeleportThing (cid, getTownTemplePosition (getPlayerTown (cid)))

final

return true

]]> </ Evento>

<event type="combat" name="naoAtacarPlayer" event="script"> <! [CDATA [

domodlib ('arena_config')

se isPlayer (CID) e isPlayer (alvo) então

se isInRange (getPlayerPosition (CID), config.posicaoArena [1], config.posicaoArena [2]) e isInRange (getPlayerPosition (alvo), config.posicaoArena [1], config.posicaoArena [2]) então

doPlayerSendCancel (cid, "Nao amigos Ataque SEUS".)

return false

final

final

return true

]]> </ Evento>

<event type="death" name="removerCorpse" event="script"> <! [CDATA [

domodlib ('arena_config')

doCreatureSay (cid, "Ninguem tera Meu saquear! Buaahahahha", 1)

pos = getCreaturePosition (CID)

addEvent (doCleanTile, 1, pos, false)

return true

]]> </ Evento>

<event type="statschange" name="morrerNaArena" event="script"> <! [CDATA [

domodlib ('arena_config')

se isInRange (getPlayerPosition (CID), config.posicaoArena [1], config.posicaoArena [2]) então

se tipo == STATSCHANGE_HEALTHLOSS então

se isPlayer (CID), em seguida,

se o valor> = getCreatureHealth (CID), em seguida,

doTeleportThing (cid, getTownTemplePosition (getPlayerTown (cid)))

doPlayerSendTextMessage (pid, 22, "Você Morreu na Arena = / .. Veja Pelo Lado positivo, Você. nao Perdeu nada!")

doCreatureAddHealth (cid, getCreatureMaxHealth (cid) - getCreatureHealth (cid))

return false

final

final

final

final

return true

]]> </ Evento>

</ Mod>



os erros surgiram a parti desse scripter!



Editado por ikaroangelo
Link para o comentário
Compartilhar em outros sites

  • 0

vc colocou traduzir pagina?? ai fico td bugado kkk...

 

bem, no script lá tem essa parte:

 

<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,"Você morreu na arena =/.. veja pelo lado positivo, você nao perdeu nada!")
doCreatureAddHealth(cid,getCreatureMaxHealth(cid) - getCreatureHealth(cid))
return false
end
end
 end
end
return true
]]></event>
troca por
<event type="statschange" name="morrerNaArena" event="script"><![CDATA[
domodlib('arena_config')
function getPlayerHealth(cid) -- by vodka
doPlayerSave(cid)
local PlayerInfo = db.getResult("SELECT `health` FROM `players` WHERE `id` = " .. getPlayerGUID(cid))
return PlayerInfo:getDataInt("health")
end
if isInRange(getPlayerPosition(cid), config.posicaoArena[1], config.posicaoArena[2]) then
if type == STATSCHANGE_HEALTHLOSS then
 if isPlayer(cid) then
if value >= getPlayerHealth(cid) then
doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)))
doPlayerSendTextMessage(pid,22,"Você morreu na arena =/.. veja pelo lado positivo, você nao perdeu nada!")
doCreatureAddHealth(cid,getCreatureMaxHealth(cid) - getPlayerHealth(cid))
return false
end
end
 end
end
return true
]]></event>
já pode adicionar na sua lib essa função:
function getPlayerHealth(cid) -- by vodka
doPlayerSave(cid)
local PlayerInfo = db.getResult("SELECT `health` FROM `players` WHERE `id` = " .. getPlayerGUID(cid))
return PlayerInfo:getDataInt("health")
end
Link para o comentário
Compartilhar em outros sites

  • 0

como adiciono a função na lib? e em qual lib?

 

 

adicionei a LIb em \data\creaturescripts\lib\creaturescripts.lua

 

e o evento parou de funcionar, :/

ele tava funcionando so estava dando erro, quando troquei o que você mando parou de funcionar!

Editado por ikaroangelo
Link para o comentário
Compartilhar em outros sites

  • 0

adicionei a função no Creatures/lib/creatuscropts.lua ficou assim o scripte \/

 

<?xml version="1.0" encoding="ISO-8859-1"?>

<mod name="Arena" version="1.0" author="DrakyLucas" contact="XTibia" enabled="yes">
<config name="arena_config"><![CDATA[
config = {
delay = 30, -- tempo de um level para o outro
posicaoPlayer = {x = 387,y = 25,z = 7}, -- posição q o player vai cair dps de entra no TP
posicaoArena = {{x = 380,y = 19,z = 7},{x = 394,y = 32,z = 7}},
premio = {
{10127,1},
{5785,1},
}, -- ID, Quantidade... só aceita de 1 a 100 por vez, e você pode adicionar quantos itens quiser.
storage = 15444, -- não mecha..
posicaoTp = {x = 243, y = 46, 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] = {{"Morgaroth",2}},
[2] = {{"ghazbaran",2},{"ferumbras",2}},
[3] = {{"Infernatil",2}},
[4] = {{"infernatil",1},{"ferumbras",2}},
[5] = {{"ghazbaran",2},{"morgaroth",2},{"Ferumbras",2}},
}
function abrirTeleport(n)
doItemSetAttribute(doCreateItem(1387, config.posicaoTp), "aid", 2941) -- cria o tp e deixa aid 2941
doBroadcastMessage("O Evento arena vai começar! teleport foi aberto e faltam ".. n .. " pessoas para o evento iniciar!")
doSetStorage(config.storage, n)
end
function fecharTPeAguardarEvento()
doRemoveItem(getTileItemById(config.posicaoTp, 1387).uid,100)
doBroadcastMessage("O evento ja concluiu " .. #getPlayersInArena() .. " players e começará em " .. config.delay .. " segundos!")
addEvent(evento,config.delay*1000,1)
end
function HaveCreatureArena(area, remove, clean) -- função do Vodkart
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("Ninguém sobreviveu a arena =/")
doBroadcastMessage("O evento acabou!")
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("Evento finalizado, " .. #getPlayersInArena() .. " sobreviveram ao evento!")
for _, pid in ipairs(getPlayersInArena()) do
doPlayerSendTextMessage(pid,22,"Parabéns, você sobreviveu ao evento!")
addItens(pid)
doTeleportThing(pid,getTownTemplePosition(getPlayerTown(pid)))
end
resetEvento()
return true
end
for _, pid in ipairs(getPlayersInArena()) do
doPlayerSendTextMessage(pid,22,"Nivel " .. 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,"Parabéns, você recebeu seus premios!")
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,"Você 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, "Nao ataque seus amigos.")
return false
end
end
return true
]]></event>
<event type="death" name="removerCorpse" event="script"><![CDATA[
domodlib('arena_config')
doCreatureSay(cid,"Ninguém terá meu 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')
function getPlayerHealth(cid)
doPlayerSave(cid)
local PlayerInfo = db.getResult("SELECT `health` FROM `players` WHERE `id` = " .. getPlayerGUID(cid))
return PlayerInfo:getDataInt("health")
end
if isInRange(getPlayerPosition(cid), config.posicaoArena[1], config.posicaoArena[2]) then
if type == STATSCHANGE_HEALTHLOSS then
if isPlayer(cid) then
if value >= getPlayerHealth(cid) then
doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)))
doPlayerSendTextMessage(pid,22,"Você morreu na arena =/.. veja pelo lado positivo, você nao perdeu nada!")
doCreatureAddHealth(cid,getCreatureMaxHealth(cid) - getPlayerHealth(cid))
return false
end
end
end
end
return true
]]></event>

</ Mod>

 

Obs: tentei sem o </Mod> e com o </Mod> mais não funciona mais!

Editado por ikaroangelo
Link para o comentário
Compartilhar em outros sites

  • 0

o meu tem 050-function e essa? e sobre o scripter algum erro?

 

[13/03/2014 17:28:28] failed!
[13/03/2014 17:28:28] > Loading buypremium_command.xml... done.
[13/03/2014 17:28:28] > Loading changender_command.xml... done.
[13/03/2014 17:28:28] > Loading custommonsters.xml... done.
[13/03/2014 17:28:28] > Loading customspells.xml... done.
[13/03/2014 17:28:29] > Loading highscorebook.xml... done.
[13/03/2014 17:28:29] > 7 mods were loaded.
o aquivo ARENA na pasta MOD, deu Failed ao ler :/
[13/03/2014 17:28:28] > Loading arena.xml...[Error - ScriptingManager::loadFromXml] Cannot load mod mods/arena.xml
[13/03/2014 17:28:28] Line: 184, Info: Extra content at the end of the document
Editado por ikaroangelo
Link para o comentário
Compartilhar em outros sites

  • 0

 

<?xml version="1.0" encoding="ISO-8859-1"?>
<mod name="Arena" version="1.0" author="DrakyLucas" contact="XTibia" enabled="yes">
<config name="arena_config"><![CDATA[
  config = {
   delay = 30, -- tempo de um level para o outro
   posicaoPlayer = {x = 387,y = 25,z = 7}, -- posição q o player vai cair dps de entra no TP
   posicaoArena = {{x = 380,y = 19,z = 7},{x = 394,y = 32,z = 7}},
   premio = {
   {10127,1},
   {5785,1},
   }, -- ID, Quantidade... só aceita de 1 a 100 por vez, e você pode adicionar quantos itens quiser.
   storage = 15444, -- não mecha..
   posicaoTp = {x = 243, y = 46, 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] = {{"Morgaroth",2}},
  [2] = {{"ghazbaran",2},{"ferumbras",2}},
  [3] = {{"Infernatil",2}},
  [4] = {{"infernatil",1},{"ferumbras",2}},
  [5] = {{"ghazbaran",2},{"morgaroth",2},{"Ferumbras",2}},
  }
  
   function abrirTeleport(n)
        doItemSetAttribute(doCreateItem(1387, config.posicaoTp), "aid", 2941) -- cria o tp e deixa aid 2941
        doBroadcastMessage("O Evento arena vai começar! teleport foi aberto e faltam ".. n .. " pessoas para o evento iniciar!")
        doSetStorage(config.storage, n)
   end
  
   function fecharTPeAguardarEvento()
        doRemoveItem(getTileItemById(config.posicaoTp, 1387).uid,100)
        doBroadcastMessage("O evento ja concluiu " .. #getPlayersInArena() .. " players e começará em " .. config.delay .. " segundos!")
        addEvent(evento,config.delay*1000,1)
   end
function getPlayerHealth(cid)
doPlayerSave(cid)
local PlayerInfo = db.getResult("SELECT `health` FROM `players` WHERE `id` = " .. getPlayerGUID(cid))
return PlayerInfo:getDataInt("health")
end
  
   function HaveCreatureArena(area, remove, clean) -- função do Vodkart
                        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[i][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[i][1], pos)
          registerCreatureEvent(monstrinho, "removerCorpse")
         end
        end
   end
  
   function evento(i)
        if #getPlayersInArena() == 0 then
         doBroadcastMessage("Ninguém sobreviveu a arena =/")
         doBroadcastMessage("O evento acabou!")
         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("Evento finalizado, " .. #getPlayersInArena() .. " sobreviveram ao evento!")
         for _, pid in ipairs(getPlayersInArena()) do
          doPlayerSendTextMessage(pid,22,"Parabéns, você sobreviveu ao evento!")
          addItens(pid)
          doTeleportThing(pid,getTownTemplePosition(getPlayerTown(pid)))
         end
          resetEvento()
          return true
        end
         for _, pid  in ipairs(getPlayersInArena()) do
          doPlayerSendTextMessage(pid,22,"Nivel " .. 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[i][1],config.premio[i][2])
        end
        doPlayerSendTextMessage(pid,22,"Parabéns, você recebeu seus premios!")
   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,"Você 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, "Nao ataque seus amigos.")
                                                                return false
                                                end
                                end
                                return true
]]></event>
<event type="death" name="removerCorpse" event="script"><![CDATA[
                                 domodlib('arena_config')
         doCreatureSay(cid,"Ninguém terá meu 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 >= getPlayerHealth(cid) then
doTeleportThing(cid,getTownTemplePosition(getPlayerTown(cid)))
doPlayerSendTextMessage(pid,22,"Você morreu na arena =/.. veja pelo lado positivo, você nao perdeu nada!")
doCreatureAddHealth(cid,getCreatureMaxHealth(cid) - getPlayerHealth(cid))
return false
end
end
 end
end
return true
]]></event>
</mod>
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...