E
Evil Puncker
Guest
I found a really old script for death broadcast, but it is just showing "player name [lvl]" and not the rest of was killed by etc... message:
what could be wrong? I'm using tfs 1.3
Lua:
function onDeath(cid, corpse)
local creature = Creature(cid)
local damageMap = creature:getDamageMap()
for creatureId, damage in pairs(damageMap) do
local thing = Creature(creatureId)
end
i = 0
str = getCreatureName(cid).." ["..getPlayerLevel(cid).."]"
for _, pid in ipairs(damageMap) do
i = i + 1
if (i == 1) then
if(#damageMap <= 1) then
str = str.." was killed by "
elseif(#damageMap > 1 and #damageMap <= 4) then
str = str.." was slain by "
elseif(#damageMap > 4 and #damageMap <= 7) then
str = str.." was crushed by "
elseif(#damageMap > 7 and #damageMap <= 10) then
str = str.." was eliminated by "
elseif(#damageMap > 10) then
str = str.." was annihilated by "
end
elseif (i == #damageMap) then
str = str.." and "
else
str = str..", "
end
if not(isPlayer(pid) or isMonster(pid)) then
str = str.."a field item"
elseif isSummon(pid) then
str = str.."a "..getCreatureName(pid):lower().." summoned by "..(isPlayer(getCreatureMaster(pid)) and "" or "a ")..""..getCreatureName(getCreatureMaster(pid))
elseif isPlayer(pid) then
str = str..""..getCreatureName(pid)
elseif isMonster(pid) then
str = str.."a "..getCreatureName(pid):lower()
end
end
str = str.."."
Game.broadcastMessage(str, MESSAGE_STATUS_WARNING)
print(str)
return true
end
what could be wrong? I'm using tfs 1.3