Ir para conteúdo
  • Cadastre-se

(Resolvido)Death


Ir para solução Resolvido por ViitinG,

Posts Recomendados

seria mais fácil por sistema de mandado de mort!

esse sistema funciona como?

simples funciona quando o player executa um comando come do player oferecendo recompensa,

o player que matar esse ((furlano) recebera a tal recompensa que pode ser configurado)

                                                                         github.png TFS 0.4 DEV                                                                                                       nvzl0l.jpg
 
Página no facebook: https://www.facebook.com/Suporterking                                                                                     
Skype: fabinhodias01
 
 
"A almapermanece em suas criações" 


h3dhnuI.jpg           
(Dou suporte apenas em tópicos..)

Link para o post
Compartilhar em outros sites
  • Solução

"data/creaturescripts/scripts/deathBroadcast.lua" :

local config = {
    affected = 10, -- how many players (deathAssits) from table deathList should this script be executed for?

    killStorageValue = 3943,
    deathStorageValue = 3944,

    -- commands for the texts (those inside of ||, example: |KILLS| to show skills): KILLS, KILLERNAME, TARGETNAME
    rewardItem = {
        use = true,
        itemid = 2152,
        minLevel = false, -- false if you don't want any level req
        minLevelDiff = false, -- false if you don't want any level diff req (negative numbers allowed).
    },

    killMessage = {
        use = true,
        text = "You owned |TARGETNAME|! You have now |KILLERKILLS| kills!",
        messageClass = MESSAGE_STATUS_CONSOLE_BLUE
    },

    broadcastMessage = {
        use = false,
        minLevel = false, -- false if you don't want any level req
        minLevelDiff = false, -- false if you don't want any level diff req (negative numbers allowed).
        text = "|KILLERNAME| [|KILLERLEVEL|] just killed |TARGETNAME| [|TARGETLEVEL|]!",
        messageClass = MESSAGE_STATUS_WARNING
    },

    killerAnimation = {
        use = true,
        text = "Frag!", -- Only 9 letters! No "commands" here.
        color = 144
    },

    targetAnimation = {
        use = true,
        text = "OWNED!!", -- Only 9 letters! No "commands" here.
        color = 180
    }
}

function onDeath(cid, corpse, deathList)
    for i = 1, math.min(config.affected, getConfigInfo('deathAssistCount')) do
        local killer = deathList[i]
        if(isPlayer(killer) == TRUE) then
            local targetKills = math.max(0, getPlayerStorageValue(cid, config.killStorageValue)) + 1
            local targetDeaths = math.max(0, getPlayerStorageValue(cid, config.deathStorageValue)) + 1
        
            local killerKills = math.max(0, getPlayerStorageValue(killer, config.killStorageValue)) + 1
            local killerDeaths = math.max(0, getPlayerStorageValue(killer, config.deathStorageValue)) + 1
        
            setPlayerStorageValue(killer, config.killStorageValue, targetKills)
            setPlayerStorageValue(cid, config.deathStorageValue, targetDeaths)

            local killerLevel = getPlayerLevel(killer)
            local targetLevel = getPlayerLevel(cid)
            local levelDiff = targetLevel - killerLevel

            local values = {
                ["KILLERKILLS"]         = killerKills,
                ["KILLERDEATHS"]        = killerDeaths,
                ["KILLERNAME"]          = getCreatureName(killer),
                ["KILLERLEVEL"]         = killerLevel,
            
                ["TARGETKILLS"]         = targetKills,
                ["TARGETDEATHS"]        = targetDeaths,
                ["TARGETNAME"]          = getCreatureName(cid),
                ["TARGETLEVEL"]         = targetLevel
            }

            function formateString(str)
                return(str:gsub("|([A-Z]+)|", (function(a) return values[a] end)))
            end
        
if(config.rewardItem.use and (not config.rewardItem.minLevel or targetLevel >= config.rewardItem.minLevel) and (not config.rewardItem.minLevelDiff or levelDiff >= config.rewardItem.minLevelDiff)) then
    if getPlayerIp(cid) == getPlayerIp(killer) then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você não ganha nada matando MC")
        return False
    end
    local uid = doPlayerAddItem(killer, config.rewardItem.itemid, 5)
end
            if(config.killMessage.use) then
                doPlayerSendTextMessage(killer, config.killMessage.messageClass, formateString(config.killMessage.text))
            end
            if(config.broadcastMessage.use and (not config.broadcastMessage.minLevel or getPlayerLevel(cid) >= config.broadcastMessage.minLevel) and (not config.broadcastMessage.minLevelDiff or levelDiff >= config.broadcastMessage.minLevelDiff)) then
                broadcastMessage(formateString(config.broadcastMessage.text), config.broadcastMessage.messageClass)
            end
            if(config.killerAnimation.use) then
                doSendAnimatedText(getCreaturePosition(killer), config.killerAnimation.text, config.killerAnimation.color)
            end
            if(config.targetAnimation.use) then
                doSendAnimatedText(getCreaturePosition(cid), config.targetAnimation.text, config.targetAnimation.color)
            end
        end
    end

    return true
end

function onKill(cid, target, lastHit)
 
local str = "O player %s acaba de ser morto no nível %d por %s"
 
    if isPlayer(cid) and isPlayer(target) then
        doBroadcastMessage(str:format(getCreatureName(target), getPlayerLevel(target), getCreatureName(cid)), 27)
    end
 
    return true
end

"data/creaturescripts/login.lua" :

registerCreatureEvent(cid, "DeathBroadcast")

"data/creaturescripts/creaturescripts.xml" :

<event type="kill" name="DeathBroadCast" event="script" value="deathbroadcast.lua"/>
Link para o post
Compartilhar em outros sites

 

"data/creaturescripts/scripts/deathBroadcast.lua" :

local config = {
    affected = 10, -- how many players (deathAssits) from table deathList should this script be executed for?

    killStorageValue = 3943,
    deathStorageValue = 3944,

    -- commands for the texts (those inside of ||, example: |KILLS| to show skills): KILLS, KILLERNAME, TARGETNAME
    rewardItem = {
        use = true,
        itemid = 2152,
        minLevel = false, -- false if you don't want any level req
        minLevelDiff = false, -- false if you don't want any level diff req (negative numbers allowed).
    },

    killMessage = {
        use = true,
        text = "You owned |TARGETNAME|! You have now |KILLERKILLS| kills!",
        messageClass = MESSAGE_STATUS_CONSOLE_BLUE
    },

    broadcastMessage = {
        use = false,
        minLevel = false, -- false if you don't want any level req
        minLevelDiff = false, -- false if you don't want any level diff req (negative numbers allowed).
        text = "|KILLERNAME| [|KILLERLEVEL|] just killed |TARGETNAME| [|TARGETLEVEL|]!",
        messageClass = MESSAGE_STATUS_WARNING
    },

    killerAnimation = {
        use = true,
        text = "Frag!", -- Only 9 letters! No "commands" here.
        color = 144
    },

    targetAnimation = {
        use = true,
        text = "OWNED!!", -- Only 9 letters! No "commands" here.
        color = 180
    }
}

function onDeath(cid, corpse, deathList)
    for i = 1, math.min(config.affected, getConfigInfo('deathAssistCount')) do
        local killer = deathList[i]
        if(isPlayer(killer) == TRUE) then
            local targetKills = math.max(0, getPlayerStorageValue(cid, config.killStorageValue)) + 1
            local targetDeaths = math.max(0, getPlayerStorageValue(cid, config.deathStorageValue)) + 1
        
            local killerKills = math.max(0, getPlayerStorageValue(killer, config.killStorageValue)) + 1
            local killerDeaths = math.max(0, getPlayerStorageValue(killer, config.deathStorageValue)) + 1
        
            setPlayerStorageValue(killer, config.killStorageValue, targetKills)
            setPlayerStorageValue(cid, config.deathStorageValue, targetDeaths)

            local killerLevel = getPlayerLevel(killer)
            local targetLevel = getPlayerLevel(cid)
            local levelDiff = targetLevel - killerLevel

            local values = {
                ["KILLERKILLS"]         = killerKills,
                ["KILLERDEATHS"]        = killerDeaths,
                ["KILLERNAME"]          = getCreatureName(killer),
                ["KILLERLEVEL"]         = killerLevel,
            
                ["TARGETKILLS"]         = targetKills,
                ["TARGETDEATHS"]        = targetDeaths,
                ["TARGETNAME"]          = getCreatureName(cid),
                ["TARGETLEVEL"]         = targetLevel
            }

            function formateString(str)
                return(str:gsub("|([A-Z]+)|", (function(a) return values[a] end)))
            end
        
if(config.rewardItem.use and (not config.rewardItem.minLevel or targetLevel >= config.rewardItem.minLevel) and (not config.rewardItem.minLevelDiff or levelDiff >= config.rewardItem.minLevelDiff)) then
    if getPlayerIp(cid) == getPlayerIp(killer) then
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você não ganha nada matando MC")
        return False
    end
    local uid = doPlayerAddItem(killer, config.rewardItem.itemid, 5)
end
            if(config.killMessage.use) then
                doPlayerSendTextMessage(killer, config.killMessage.messageClass, formateString(config.killMessage.text))
            end
            if(config.broadcastMessage.use and (not config.broadcastMessage.minLevel or getPlayerLevel(cid) >= config.broadcastMessage.minLevel) and (not config.broadcastMessage.minLevelDiff or levelDiff >= config.broadcastMessage.minLevelDiff)) then
                broadcastMessage(formateString(config.broadcastMessage.text), config.broadcastMessage.messageClass)
            end
            if(config.killerAnimation.use) then
                doSendAnimatedText(getCreaturePosition(killer), config.killerAnimation.text, config.killerAnimation.color)
            end
            if(config.targetAnimation.use) then
                doSendAnimatedText(getCreaturePosition(cid), config.targetAnimation.text, config.targetAnimation.color)
            end
        end
    end

    return true
end

function onKill(cid, target, lastHit)
 
local str = "O player %s acaba de ser morto no nível %d por %s"
 
    if isPlayer(cid) and isPlayer(target) then
        doBroadcastMessage(str:format(getCreatureName(target), getPlayerLevel(target), getCreatureName(cid)), 27)
    end
 
    return true
end

"data/creaturescripts/login.lua" :

registerCreatureEvent(cid, "DeathBroadcast")

"data/creaturescripts/creaturescripts.xml" :

<event type="kill" name="DeathBroadCast" event="script" value="deathbroadcast.lua"/>

deu errado

Link para o post
Compartilhar em outros sites

Oque aconteceu de errado ?

Você deve ter feito alguma coisa errada amigo, mande como ficou seu login.lua em spoiler por gentileza

local config = {
loginMessage = getConfigValue('loginMessage'),
useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}
 
function onLogin(cid)
local loss = getConfigValue('deathLostPercent')
if(loss ~= nil) then
doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
doPlayerAddBlessing(cid, 1)
doPlayerAddBlessing(cid, 2)
doPlayerAddBlessing(cid, 3)
doPlayerAddBlessing(cid, 4)
doPlayerAddBlessing(cid, 5)
end
 
local accountManager = getPlayerAccountManager(cid)
if(accountManager == MANAGER_NONE) then
local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
if(lastLogin > 0) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
else
str = str .. " Please choose your outfit."
doPlayerSendOutfitWindow(cid)
end
 
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
elseif(accountManager == MANAGER_NAMELOCK) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
elseif(accountManager == MANAGER_ACCOUNT) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
end
 
if(not isPlayerGhost(cid)) then
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
end
 
     registerCreatureEvent(cid, "kill")
     registerCreatureEvent(cid, "onPrepareDeath")
     registerCreatureEvent(cid, "PlayerLogout")
     registerCreatureEvent(cid, "Reward")
    registerCreatureEvent(cid, "DeathBroadcast")
     registerCreatureEvent(cid, "onPrepareDeath")
 
 
registerCreatureEvent(cid, "Idle")
if(config.useFragHandler) then
registerCreatureEvent(cid, "SkullCheck")
end
 
registerCreatureEvent(cid, "ReportBug")
return true
end
Link para o post
Compartilhar em outros sites

Apareceu algum erro na distro?

Te ajudei?? REP + e ficamos quites... <ahttp://www.tibiaking.com/forum/uploads/emoticons/default_happyy.png' alt=';D'>

Atenciosamente,

Daniel.

Abraços!

Link para o post
Compartilhar em outros sites

Eu usava este script no meu servidor e que eu me lembre funcionava perfeitamente, você está matando MC ?

Qual seu TFS ?

sim eu matei mc e oq e TFS n conheço siglas >.<

Link para o post
Compartilhar em outros sites

Provavelmente seu servidor tem o sistema de anti kill MC, dai você não ganha gold quando mata algum MC.

n era isso de mc mas vlw pela ajuda REP+ 

e eu tive 1 ideia pra n prescisar disso vo fazer 1 war q pra pegar os itens  ou faz 1 quest bem chatinha ou fica matando monstros ate pegar x grana pra comprar :3 acho q é uma inovaçao ja q nunca vi um war assim XD

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