Ir para conteúdo
  • Cadastre-se

(Resolvido)Fiz uma gambiarra no death channel, help


Ir para solução Resolvido por Dwarfer,

Posts Recomendados

Meu script é esse:

 

function onKill(cid, target, lastHit)

     if not isPlayer(target) or not isPlayer(cid) then
          return true
     end

     doBroadcastMessage(""..getCreatureName(target).." on level ["..getPlayerLevel(target).."] just got killed for "..getCreatureName(cid).." on level ["..getPlayerLevel(cid).."].", MESSAGE_STATUS_CONSOLE_BLUE)
    return true
end

 

A gambiarra que eu fiz para aparecer no death channel

 

if not isPlayer(target) or not isPlayer(cid) then
          return true
     end

     doPlayerSendChannelMessage(oid, "Death channel", ""..getCreatureName(target).." on level ["..getPlayerLevel(target).."] just got killed for "..getCreatureName(cid).." on level ["..getPlayerLevel(cid).."].", MESSAGE_STATUS_CONSOLE_BLUE)
    return true
end

 

E porque o chat não abre? Registrei isso depois do return true no login lua.

 

doPlayerOpenChannel(cid, 10)

 

E isso na lib constant

 

CHANNEL_DEATH = 10

E isso no xml

 

    <channel id="10" active="no" logged="yes" name="Death Channel"/>

 

 

 

(1º) | [8.60] - Galaxy Server - Download

(2º) | [8.60] - Glorious Server - Download

(3º) | [8.60] - Epic Server - Download

Link para o post
Compartilhar em outros sites

Traduzi a mensagem quando mata;

Quando você usa uma função tem que ver qual volores ela pede ( )


function onKill(cid, target, lastHit)
    if not isPlayer(target) or not isPlayer(cid) then
        return true
    end
    doPlayerSendChannelMessage(cid, "Death-Chat", "O Jogador "..getCreatureName(target).." no nivel ["..getPlayerLevel(target).."] foi morto pelo "..getCreatureName(cid).." que esta level ["..getPlayerLevel(cid).."].", TALKTYPE_CHANNEL_R1, CHANNEL_DEATH)
    print("oi")
return true
end

 

Te ajudei ?? Que tal fazer uma contribuição ?

Doar

Link para o post
Compartilhar em outros sites
54 minutos atrás, DboExplorer disse:

Traduzi a mensagem quando mata;

Quando você usa uma função tem que ver qual volores ela pede ( )

 


function onKill(cid, target, lastHit)
    if not isPlayer(target) or not isPlayer(cid) then
        return true
    end
    doPlayerSendChannelMessage(cid, "Death-Chat", "O Jogador "..getCreatureName(target).." no nivel ["..getPlayerLevel(target).."] foi morto pelo "..getCreatureName(cid).." que esta level ["..getPlayerLevel(cid).."].", TALKTYPE_CHANNEL_R1, CHANNEL_DEATH)
    print("oi")
return true
end

 

 

Funcionou, você consegue por para mostrar os bixos e outros players que ajudaram a matar?

(1º) | [8.60] - Galaxy Server - Download

(2º) | [8.60] - Glorious Server - Download

(3º) | [8.60] - Epic Server - Download

Link para o post
Compartilhar em outros sites
9 horas atrás, DboExplorer disse:

Ai vai precisar usar a função OnDeath mais tarde eu faço

 

No aguardo.

 

06:40 Death channel: Joaozinhosz was killed at level 103 by Suco De Uva, Sharingan.

(1º) | [8.60] - Galaxy Server - Download

(2º) | [8.60] - Glorious Server - Download

(3º) | [8.60] - Epic Server - Download

Link para o post
Compartilhar em outros sites
  • 2 weeks later...
  • Solução

@jNo

 

Em creaturescripts/scripts:

 

deathchannel.lua

 

Spoiler

function onDeath(cid, corpse, deathList)
    if not isPlayer(cid) then return true end
    local killers, i = "", 1
    for _, v in pairs(deathList) do
        killers = killers .. getCreatureName(v) .. (i == #deathList and "" or ", ")
        i = i + 1
    end
    local msg = "Player " .. getPlayerName(cid) .. "["..getPlayerLevel(cid).."] was killed by " .. killers
    for _, pid in ipairs(getPlayersOnline()) do
        doPlayerSendChannelMessage(pid, "Death Channel:", msg, TALKTYPE_CHANNEL_R1, 10)
    end
return true
end

 

 

Registre no login.lua: registerCreatureEvent(cid, "DeathChannel")

 

Adicione a tag no creaturescripts.xml: <event type="death" name="DeathChannel" event="script" value="deathchannel.lua"/>

 

Editado por Dwarfer (veja o histórico de edições)

Contato:

 

Link para o post
Compartilhar em outros sites
4 horas atrás, Dwarfer disse:

@jNo

 

Em creaturescripts/scripts:

 

deathchannel.lua

 

  Mostrar conteúdo oculto


function onDeath(cid, corpse, deathList)
    if not isPlayer(cid) then return true end
    local killers, i = "", 1
    for _, v in pairs(deathList) do
        killers = killers .. getCreatureName(v) .. (i == #deathList and "" or ", ")
        i = i + 1
    end
    local msg = "Player " .. getPlayerName(cid) .. "["..getPlayerLevel(cid).."] was killed by " .. killers
    for _, pid in ipairs(getPlayersOnline()) do
        doPlayerSendChannelMessage(pid, "Death Channel:", msg, TALKTYPE_CHANNEL_R1, 10)
    end
return true
end

 

 

Registre no login.lua: registerCreatureEvent(cid, "DeathChannel")

 

Adicione a tag no creaturescripts.xml: <event type="death" name="DeathChannel" event="script" value="deathchannel.lua"/>

 

 

 

vlw jow perfect

(1º) | [8.60] - Galaxy Server - Download

(2º) | [8.60] - Glorious Server - Download

(3º) | [8.60] - Epic Server - Download

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo