MA

Anunciador de morte avançado

Por matheusata55, 20 de jun. de 2016 em Scripts

13
2.8k
20 de junho de 2016 às 12:22

bom galera, aqui no forum existe scripts de anunciador de morte mas nao igual eu desejo, gostaria que quando o player morrece pra bicho ou pra player aprecesse no default \/

dead.png

dead.png.2ce59e62fb7b0fa7ed936466674308f0.png

Yan LiimaY
20 de junho de 2016 às 13:17

Tenta ai

 

Em creaturescript/script crie um arquivo com um nome de sua preferencia e cole isto dentro:

function onDeath(cid, corpse, deathList)    if not isPlayer(cid) then        return true    end    	local killer = deathList[1]     if isMonster(killer) then        doBroadcastMessage(getCreatureName(cid).." [Level: "..getPlayerLevel(cid)..] foi morto pelo monstro "..getCreatureName(killer).."." , MESSAGE_STATUS_CONSOLE_ORANGE)    elseif isPlayer(killer) then        doBroadcastMessage(getCreatureName(cid).." [Level: "..getPlayerLevel(cid)..] foi morto pelo jogador "..getCreatureName(killer).." [Level: "..getPlayerLevel(killer)..].", MESSAGE_STATUS_CONSOLE_ORANGE)    end   	return trueendfunction onLogin(cid)	registerCreatureEvent(cid, "DeathPlayer")    return trueend

 

No creaturescript.xml adicione:

<event type="death" name="DeathPlayer" event="script" value="NOME_DO_ARQUIVO.lua"/><event type="login" name="DeathLogin" event="script" value="NOME_DO_ARQUIVO.lua"/>

 

Se quiser tem um script que também é muito bom:

 

Editado Junho 20 por nedroesdoksdja

Night WolfN
20 de junho de 2016 às 13:36

@Yan Liima faz por onDeath que a onKill é chamada pelo menos uma vez pra cada killer. Vai aparecer morte duplicada. 

Jakson SouzaJ
20 de junho de 2016 às 13:45
8 minutos atrás, Night Wolf disse:

@Yan Liima faz por onDeath que a onKill é chamada pelo menos uma vez pra cada killer. Vai aparecer morte duplicada. 

Fiz um código desse faz tempo já com onKill, fiquei na duvida entra onKill/onDeath agora o lobo me tirou essa duvida. vlw  HEUHA

Editado Junho 20 por Jakson Souza

Night WolfN
20 de junho de 2016 às 13:47
1 minuto atrás, Jakson Souza disse:

Fiz um código desse faz tempo já por onKill, fiquei na duvida entra onKill/onDeath agora o lobo me tirou essa duvida. vlw  HEUHA

é bem fácil converter, mas antes de começar o código vc tem que se preocupar:

é pra executar ele pra cada pessoa que matou?

SIM -> onKill,

NÃO -> onDeath

 

claro que tem outras implicações, mas no geral é isso aí.

Yan LiimaY
20 de junho de 2016 às 13:48
10 minutos atrás, Night Wolf disse:

@Yan Liima faz por onDeath que a onKill é chamada pelo menos uma vez pra cada killer. Vai aparecer morte duplicada. 

Ah imaginei que iria dar alguma merda, só não sabia qual rsrs valeu Wolf sempre me ajudando <3

E eu tinha esquecido da TAG login... Já editei e eu tava precisando falar contigo ...

2 minutos atrás, Jakson Souza disse:

Fiz um código desse faz tempo já com onKill, fiquei na duvida entra onKill/onDeath agora o lobo me tirou essa duvida. vlw  HEUHA

RSRS

20 de junho de 2016 às 14:21
Agora, Yan Liima disse:

Tenta ai

 

Em creaturescript/script crie um arquivo com um nome de sua preferencia e cole isto dentro:

function onDeath(cid, corpse, deathList)    if not isPlayer(cid) then        return true    end    	local killer = deathList[1]     if isMonster(killer) then        doBroadcastMessage(getCreatureName(cid).." [Level: "..getPlayerLevel(cid)..] foi morto pelo monstro "..getCreatureName(killer).."." , MESSAGE_STATUS_CONSOLE_ORANGE)    elseif isPlayer(killer) then        doBroadcastMessage(getCreatureName(cid).." [Level: "..getPlayerLevel(cid)..] foi morto pelo jogador "..getCreatureName(killer).." [Level: "..getPlayerLevel(killer)..].", MESSAGE_STATUS_CONSOLE_ORANGE)    end   	return trueendfunction onLogin(cid)	registerCreatureEvent(cid, "DeathPlayer")end

 

No creaturescript.xml adicione:

<event type="death" name="DeathPlayer" event="script" value="NOME_DO_ARQUIVO.lua"/><event type="login" name="MorteLogin" event="script" value="NOME_DO_ARQUIVO.lua"/>

 

Se quiser tem um script que também é muito bom:

 

 

 

 

 

 

 

mano, o char loga e desloga ao mesmo tempo, aparece so isso na distro, tem algo errado.

Yan LiimaY
20 de junho de 2016 às 14:48
function onDeath(cid, corpse, deathList)    if not isPlayer(cid) then        return true    end    	local killer = deathList[1]     if isMonster(killer) then        doBroadcastMessage(getCreatureName(cid).." [Level: "..getPlayerLevel(cid).."] foi morto pelo monstro "..getCreatureName(killer).."." , MESSAGE_STATUS_CONSOLE_ORANGE)    elseif isPlayer(killer) then        doBroadcastMessage(getCreatureName(cid).." [Level: "..getPlayerLevel(cid).."] foi morto pelo jogador "..getCreatureName(killer).." [Level: "..getPlayerLevel(killer).."].", MESSAGE_STATUS_CONSOLE_ORANGE)    end   	return trueend

TAG:

<event type="death" name="DeathPlayer" event="script" value="NOME_DO_ARQUIVO.lua"/>

No seu login.lua add

registerCreatureEvent(cid, "DeathPlayer")

 

Editado Junho 20 por nedroesdoksdja

20 de junho de 2016 às 15:06
Agora, Yan Liima disse:
function onDeath(cid, corpse, deathList)    if not isPlayer(cid) then        return true    end    	local killer = deathList[1]     if isMonster(killer) then        doBroadcastMessage(getCreatureName(cid).." [Level: "..getPlayerLevel(cid).."] foi morto pelo monstro "..getCreatureName(killer).."." , MESSAGE_STATUS_CONSOLE_ORANGE)    elseif isPlayer(killer) then        doBroadcastMessage(getCreatureName(cid).." [Level: "..getPlayerLevel(cid).."] foi morto pelo jogador "..getCreatureName(killer).." [Level: "..getPlayerLevel(killer).."].", MESSAGE_STATUS_CONSOLE_ORANGE)    end   	return trueend

TAG:

<event type="death" name="DeathPlayer" event="script" value="NOME_DO_ARQUIVO.lua"/>

 

 

 

 

o bicho ta matando ele e nao ta anunciando

Yan LiimaY
20 de junho de 2016 às 15:18
1 hora atrás, matheusata55 disse:

 

 

 

o bicho ta matando ele e nao ta anunciando

 

Tu adicionou o registerCreatureEvent(cid, "DeathPlayer") no login.lua?

 

Então tenta assim, creio que agora de certo:

function onDeath(cid, corpse, deathList)    if not isPlayer(cid) then        return true    end    	local killer = deathList[1]     if isMonster(killer) then        doBroadcastMessage(getCreatureName(cid).." [Level: "..getPlayerLevel(cid).."] foi morto pelo monstro "..getCreatureName(killer).."." , MESSAGE_STATUS_CONSOLE_ORANGE)    elseif isPlayer(killer) then        doBroadcastMessage(getCreatureName(cid).." [Level: "..getPlayerLevel(cid).."] foi morto pelo jogador "..getCreatureName(killer).." [Level: "..getPlayerLevel(killer).."].", MESSAGE_STATUS_CONSOLE_ORANGE)    end	return trueendfunction onLogin(cid)	registerCreatureEvent(cid, "DeathPlayer")	return trueend

TAG:

<event type="death" name="DeathPlayer" event="script" value="NOME_DO_ARQUIVO.lua"/><event type="login" name="DeathLogin" event="script" value="NOME_DO_ARQUIVO.lua"/>

 

Editado Junho 20 por nedroesdoksdja

Animal PakA
20 de junho de 2016 às 15:29

Funcional em tfs 0.4? Porque todos os script de anunciar morte que testei no tfs 0.4 funciona na primeira morte aí da erro sem parar na função doBroadcastMessage

Yan LiimaY
20 de junho de 2016 às 16:19
49 minutos atrás, Animal Pak disse:

Funcional em tfs 0.4? Porque todos os script de anunciar morte que testei no tfs 0.4 funciona na primeira morte aí da erro sem parar na função doBroadcastMessage

 

Sim acabei de testar, e tinha um pequeno erro na TAG desculpe, já editei.

PoccnnP
20 de junho de 2016 às 21:11

@yan liima, caso tenha mais de um assassino, apenas o nome de um é que será mostrado. Cria um loop para pegar o nome de todos que tiver na deathlist.