• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 1.X+ Add broadcast message when player dies in infinite PVP arena

ralke

(҂ ͠❛ ෴ ͡❛)ᕤ
Joined
Dec 17, 2011
Messages
1,521
Solutions
27
Reaction score
870
Location
Santiago - Chile
GitHub
ralke23
Twitch
ralke23
Hi again! I wonder if someone can help me improving a system i've been using for quite long. Is this thread:

I would like to send a broadcast message every time that a player dies inside the arena, like:
Code:
Ralke was killed by Player, Player2, Player3 and Player4
Using the damage map to achieve the amount of players that contribute on the kill.

Consider that function creatureeventPvPArena.onPrepareDeath(creature, killer) will prevent player's death if is inside the arena. So everytime a player dies in arena it doesn't actually die, it just get out.

I will really appreciate any help with this 🙏
Thanks in advance!
 
Last edited:
adapt this

maybe
in add creatureeventPvPArena.onPrepareDeath

Lua:
local k = {}
    local creatures = {}
-----------------------------------------------------------------------
  --  local player = creature:getPlayer()
 --   if not player then
  --      return true
--    end
--------------------------------------------------------------------
    local deathList = creature:getDamageMap()
--or
   -- local deathList = player:getDamageMap()

    if next(deathList) then
        for creature2, damage in pairs(deathList) do
            creature2 = creature2 >= 0x21000000 and Monster(creature2) or Player(creature2)



            if creature2 then
                if not creatures[creature2:getName():lower()] then
                    if creature2:getMaster() then
                        k[#k+1] = "a " .. creature2:getName():lower() .. " summoned by " .. (creature2:getMaster():isPlayer() and "" or "a ") .. creature2:getMaster():getName()
                    elseif creature2:isPlayer() then
                        k[#k+1] = creature2:getName()
                    elseif creature2:isMonster() then
                        k[#k+1] = "a " .. creature2:getName():lower()
                    end
                    creatures[creature2:getName():lower()] = 1
                end
            end
        end


Game.broadcastMessage(creature:getName() .. " [" .. creature:getLevel() .. "]" .. subType(#k) .. table.concat(k, ", "):gsub("(.*),", "%1 and") .. ".")


Ralke [1211] was killed by Player, Player2, Player3 and Player4
 
Last edited:
Back
Top