• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Most dmg in monsters X,Y TFS 1.2

president vankk

Web Developer & AuraOT Owner
Joined
Jul 10, 2009
Messages
5,719
Solutions
9
Reaction score
339
Hi my dear friends.

I'm currently trying trying to print the player who did most Damage on monsters x,y. I don't think that I'm using it right.

Code:
local names = {'x', 'y'}

function onDeath(creature, corpse, lastHitKiller, mostDamageKiller, lastHitUnjustified, mostDamageUnjustified)
    local monster = target:getMonster()
    if not monster then
        return true
    end
  
    if not (isInArray(names, monster:getName():lower())) then
        return true
    end
  
    local damageMap = monster:getDamageMap()
    for id, damage in pairs(damageMap) do
        local player = Player(id)
        if player then
            print(player:getName())
        end
    end
    return true
end

Thanks.
 
Last edited:
Back
Top