Does anyone have a broadcasting script that will broadcast a players death regardless as to what kills them? i had a working one for my old server but its not working for TFS 0.3.5..
Thanks in advance
function onDeath(cid, corpse, killer)
if isPlayer(cid) then
doBroadcastMessage("".. getPlayerName(cid) .." has been killed by ".. getCreatureName(killer) .." at ".. getPlayerLevel(cid) .." level.", 17)
end
return TRUE
end
[B]XX[/B] has been killed by [B]XX[/B] at [B]XX[/B] level.
Thanks , where do i add this script.. sorry im not that great at this LUA stuff.
Code:function onDeath(cid, corpse, killer) if isPlayer(cid) then doBroadcastMessage("".. getPlayerName(cid) .." has been killed by ".. getCreatureName(killer) .." at ".. getPlayerLevel(cid) .." level.", 17) end return TRUE end
Code:[B]XX[/B] has been killed by [B]XX[/B] at [B]XX[/B] level.
function onDeath(cid, corpse, lastHitKiller, mostDamageKiller)
if(isPlayer(cid) == true and isPlayer(lastHitKiller) == true) then
doBroadcastMessage( .. getPlayerName(cid) .." ["getPlayerLevel(cid)"] just got killed by ".. getCreatureName(lastHitKiller) .." [".. getPlayerLevel(lastHitKiller) .."].", 17)
end
return true
end
<event type="death" name="deathbroadcast" event="script" value="deathbroadcast.lua"/>
function onDeath(cid, corpse, deathList)
local strings = {""}
local t, position = 1, 1
local deathType = "killed"
local toSlain, toCrushed, toEliminated = 3, 9, 15
local broadcastType = MESSAGE_STATUS_CONSOLE_BLUE
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
end
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) .. " has been " .. deathType .. " at level " .. getPlayerLevel(cid) .. " by " .. str
end
doBroadcastMessage(msg, broadcastType)
return true
end
registerCreatureEvent(cid, "PlayerDeath")
<event type="death" name="PlayerDeath" event="script" value="playerdeath.lua"/>
<?xml version="1.0" encoding="UTF-8"?>
<creaturescripts>
<event type="login" name="PlayerLogin" event="script" value="login.lua"/>
<event type="joinchannel" name="GuildMotd" event="script" value="guildmotd.lua"/>
<event type="receivemail" name="Mail" event="script" value="mail.lua"/>
<event type="reportbug" name="SaveReportBug" script="reportbug.lua"/>
<event type="death" name="PlayerDeath" event="script" value="playerdeath.lua"/>
<event type="think" name="Idle" event="script" value="idle.lua"/>
<event type="think" name="SkullCheck" event="script" value="skullcheck.lua"/>
<event type="advance" name="reward" event="script" value="reward.lua"/>
<event type="logout" name="demonOakLogout" event="script" value="demonOakLogout.lua"/>
<event type="death" name="demonOakDeath" event="script" value="demonOakDeath.lua"/>
<event type="kill" name="ArenaKill" event="script" value="arenakill.lua"/>
</creaturescripts>
function onDeath(cid, corpse, deathList)
local strings = {""}
local t, position = 1, 1
local deathType = "killed"
local toSlain, toCrushed, toEliminated = 1, 3, 5
local broadcastType = MESSAGE_STATUS_CONSOLE_BLUE
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
end
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) .. " has been " .. deathType .. " at level " .. getPlayerLevel(cid) .. " by " .. str
end
doBroadcastMessage(msg, broadcastType)
return true
end
i registered it on login.lua and all the others files, and nothings, I make the question again, it should be in globalsevents or creaturescripts? I have tfs 0.3.5 crying damnson.
function onDeath(cid, corpse, deathList)
local strings = {""}
local t, position = 1, 1
local deathType = "killed"
local toSlain, toCrushed, toEliminated = 3, 9, 15
local broadcastType = MESSAGE_STATUS_CONSOLE_BLUE
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
end
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) .. " has been " .. deathType .. " at level " .. getPlayerLevel(cid) .. " by " .. str
end
doBroadcastMessage(msg, broadcastType)
return true
end
registerCreatureEvent(cid, "PlayerDeath")
<event type="death" name="PlayerDeath" event="script" value="playerdeath.lua"/>