Ir para conteúdo

Featured Replies

Postado
function onDeath(cid, corpse, deathList)
for _, pid in ipairs(deathList) do
doBroadcastMessage(""..getCreatureName(cid).." killed at level ["..getPlayerLevel(cid).."]  by  "..getCreatureName(pid).. " ", MESSAGE_STATUS_WARNING)
end
   return true
end

temgo este error:

 

11352255_10206521583336850_259305577_n.j

 

seu repite mensaje do morte. busco solo um mensaje con el nombre de todos los que lo mataron.

Postado
  • Autor

tem que colocar uma verificação para saber se é jogador, como vai pegar level de um monstro??

 

resolvi asim:

function onDeath(cid, corpse, deathList)

local strings = {""}
local t, position = 1, 1

local deathType = "killed"
local toSlain, toCrushed = 3, 9

        if #deathList >= toSlain and #deathList < toCrushed then
                deathType = "slain"
        elseif #deathList >= toCrushed then
                deathType = "crushed"
        end

        for _, pid in ipairs(deathList) do
                if isCreature(pid) == true then
                        strings[position] = t == 1 and "" or strings[position] .. ", "
                        strings[position] = strings[position] .. getCreatureName(pid) .. ""
                        t = t + 1
                else
                        strings[position] = t == 1 and "" or strings[position] .. ", "
                        strings[position] = strings[position] .."a field item"
                        t = t + 1
                end
        end

        for i, str in ipairs(strings) do
                if(str:sub(str:len()) ~= ",") then
                        str = str .. "."
                end

                msg = getCreatureName(cid) .. " was " .. deathType .. " at level " .. getPlayerLevel(cid) .. " by " .. str
        end
          
doBroadcastMessage(msg, MESSAGE_STATUS_WARNING)


   return true
end

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.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.9k

Informação Importante

Confirmação de Termo