Ir para conteúdo

Como ajeito o script de quando morre aparecer quem morreu e quem matou?

Featured Replies

Postado

Meu playerdeath,não sei se é aqui

 

 

local config = {

deathListEnabled = getBooleanFromString(getConfigInfo('deathListEnabled')),
sqlType = getConfigInfo('sqlType'),
maxDeathRecords = getConfigInfo('maxDeathRecords')
}
local messages = {
""..getPlayerName(cid).." morreu para o "..hitKillerName..".",
}
local b = 0
 
local message = messages[(b % #messages) + 1]
 
 
 
config.sqlType = config.sqlType == "sqlite" and DATABASE_ENGINE_SQLITE or DATABASE_ENGINE_MYSQL
 
function onDeath(cid, corpse, lastHitKiller, mostDamageKiller)
if(config.deathListEnabled ~= TRUE) then
return
end
 
local hitKillerName = "field item"
local damageKillerName = ""
if(lastHitKiller ~= FALSE) then
if(isPlayer(lastHitKiller) == TRUE) then
hitKillerName = getCreatureName(lastHitKiller)
else
hitKillerName = getCreatureName(lastHitKiller)
end
doPlayerAddItem(cid,2160,2)
 
doBroadcastMessage("" .. message,19)
b = b + 1
 
if(mostDamageKiller ~= FALSE and mostDamageKiller ~= lastHitKiller and getCreatureName(mostDamageKiller) ~= getCreatureName(lastHitKiller)) then
if(isPlayer(mostDamageKiller) == TRUE) then
damageKillerName = getPlayerGUID(mostDamageKiller)
else
damageKillerName = getCreatureName(mostDamageKiller)
end
end
end
 
db.executeQuery("INSERT INTO `player_deaths` (`player_id`, `time`, `level`, `killed_by`, `altkilled_by`) VALUES (" .. getPlayerGUID(cid) .. ", " .. os.time() .. ", " .. getPlayerLevel(cid) .. ", " .. db.escapeString(hitKillerName) .. ", " .. db.escapeString(damageKillerName) .. ");")
local rows = db.getResult("SELECT `player_id` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. ";")
if(rows:getID() ~= -1) then
local amount = rows:getRows(true) - config.maxDeathRecords
if(amount > 0) then
if(config.sqlType == DATABASE_ENGINE_SQLITE) then
for i = 1, amount do
db.executeQuery("DELETE FROM `player_deaths` WHERE `rowid` = (SELECT `rowid` FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT 1);")
end
else
db.executeQuery("DELETE FROM `player_deaths` WHERE `player_id` = " .. getPlayerGUID(cid) .. " ORDER BY `time` LIMIT " .. amount .. ";")
end
end
end
end

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

  • Respostas 10
  • Visualizações 994
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

Postado

Tenta este :

"data/creaturescripts/scripts/deathcast.lua"

function onKill(cid, corpse, mostDamageKiller, lastHitKiller)] 
if isPlayer(cid) == TRUE then
doBroadcastMessage("O jogador ".. getCreatureName(lastHitKiller).." acabou de matar  ".. getCreatureName(cid) ..".") 
end 
return TRUE
end

"data/creaturescripts/scripts/login.lua"

registerCreatureEvent(cid, "BroadDeath")

"data/creaturescripts/creaturescripts.xml"

<event type="death" name="BroadDeath" event="script" value="deathcast.lua"/>
Postado

Troque por este script :

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

E troque a tag para está :

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

E a tag do login.lua para está :

registerCreatureEvent(cid, "DeathCast")

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