DI

[Encerrado] "8.54" Mortes no Broadcast.

Por diarmaint, 07 de dez. de 2013 em Tópicos Sem Resposta

broadcast
mortes
narutibia
resolvido
script
5
1k
diarmaintD
07 de dezembro de 2013 às 13:15

Gostaria do script que anuncia a morte no Broadcast 8.54!

Tanto para player e monstros.

To usando esse mais não ta mostrando nada quando player morre :/

data\globalevents\scripts

 

 

local config = {

deathListEnabled = getBooleanFromString(getConfigInfo('deathListEnabled')),
sqlType = getConfigInfo('sqlType'),
maxDeathRecords = getConfigInfo('maxDeathRecords')
}
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
doBroadcastMessage(""..getPlayerName(cid).." has been killed by "..hitKillerName..".")
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

Globalevents.xml

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

data\creaturescripts\scripts\login.xml

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

Editado Dezembro 7 por Diarmaint

ScythePhantomS
07 de dezembro de 2013 às 14:56

Aqui champz, tente esse: Broadcast

diarmaintD
07 de dezembro de 2013 às 17:00

Valeu :)

GabrieltxuG
07 de dezembro de 2013 às 18:16

Tópico movido para a seção de dúvidas e pedidos resolvidos.

4 anos depois...
StigalS
21 de abril de 2018 às 03:14
A questão neste tópico de suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.