Ir para conteúdo

Featured Replies

Postado

Olá, gostaria de pedir um script de "death channel", no caso, ele funcionaria da seguinte maneira, ao player morrer, aparecesse a morte anunciada nesse channel, eu já configurei tudo, criei o channel e tal, porém não está funcionando.

 

SCRIPT: 

Mostrar conteúdo oculto

function onDeath(cid, corpse, deathList)



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

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

if #deathList >= toSlain and #deathList < toCrushed then
deathType = "slain"
elseif #deathList >= toCrushed and #deathList < toEliminated then
deathType = "crushed"
elseif #deathList >= toEliminated then
deathType = "eliminated"
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

for _, oid in ipairs(getPlayersOnline()) do
doPlayerSendChannelMessage(oid, "Death channel", msg, TALKTYPE_CHANNEL_O, CHANNEL_DEATH)
end
return true
end

 

 

TFS 0.4.

Resolvido por Vodkart

Ir para solução
  • Respostas 6
  • Visualizações 3.6k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • erro?   registrou no login.lua?   registerCreatureEvent(cid, "nome do event")   data/XML/channels.xml colocou      <channel id="10" active="no" name="Death Channel"/>   data/lib/constant.lua

  • ScythePhantom
    ScythePhantom

    Olá, gostaria de pedir um script de "death channel", no caso, ele funcionaria da seguinte maneira, ao player morrer, aparecesse a morte anunciada nesse channel, eu já configurei tudo, criei o channel

  • ScythePhantom
    ScythePhantom

    Havia esquecido de adicionar na lib, muito obrigado mesmo! Dúvida sanada.

Postado
  • Autor
  Em 04/05/2015 em 23:47, Vodkart disse:

 

erro?

 

registrou no login.lua?

 
registerCreatureEvent(cid, "nome do event")
 
data/XML/channels.xml colocou
 
   <channel id="10" active="no" name="Death Channel"/>
 
data/lib/constant.lua colocou
 
CHANNEL_DEATH = 10

 

Havia esquecido de adicionar na lib, muito obrigado mesmo! Dúvida sanada.

  • 1 year later...

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.6k

Informação Importante

Confirmação de Termo