• 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!

Crash Server onkill tfs 1.x

xGustadoIts

New Member
Joined
Apr 13, 2015
Messages
50
Reaction score
0
Hello,
I am using it and when I summon ' utevo res "fire elemental" ' a monster and it kills the boss server crash
I have a bad English, using translator sorry
Can anybody help me?

Code:
function onKill(cid, target)

target = Monster(target)
    if (target ~= nil) then
        local mt = MonsterType(target:getName())
        if mt:useRewardChest() then
            local loot = BossLoot:new(target)
            if loot then
                local corpse = Item(doCreateItem(MonsterType(target:getName()):getCorpseId(), 1, target:getPosition()))
        corpse:decay()
                target:setDropLoot(false)
                loot:updateDamage()
                loot:setRewards()
        loot:addRewards()
                corpse:setAttribute('aid', 21584)
            end
        end
    end
    return true
end
 
try to remove some lines under local corpse = and see if it still crashes, if it does then also remove that line together with lines below (until first end)
 
Code:
function onKill(cid, target)

target = Monster(target)
    if (target ~= nil) then
        local mt = MonsterType(target:getName())
        if mt:useRewardChest() then
            local loot = BossLoot:new(target)
            if loot then
                local corpse = Item(doCreateItem(MonsterType(target:getName()):getCorpseId(), 1, target:getPosition()))
            end
        end
    end
    return true
end
does it crash still?
 
Code:
function onKill(cid, target)

target = Monster(target)
    if (target ~= nil) then
        local mt = MonsterType(target:getName())
        if mt:useRewardChest() then
            local loot = BossLoot:new(target)
            if loot then
                local corpse = Item(doCreateItem(MonsterType(target:getName()):getCorpseId(), 1, target:getPosition()))
            end
        end
    end
    return true
end
does it crash still?

No crash, but the reward chest does not work as it should

Test 2, remove ' loot:updateDamage() '
Code:
function onKill(cid, target)

target = Monster(target)
    if (target ~= nil) then
        local mt = MonsterType(target:getName())
        if mt:useRewardChest() then
            local loot = BossLoot:new(target)
            if loot then
                local corpse = Item(doCreateItem(MonsterType(target:getName()):getCorpseId(), 1, target:getPosition()))
        corpse:decay()
                target:setDropLoot(false)
                loot:setRewards()
        loot:addRewards()
                corpse:setAttribute('aid', 21584)
            end
        end
    end
    return true
end

No crash, but the reward chest does not work as it should
Can you help me? You need the full script?
 
Unfortunately I don't know what function updateDamage does. Can you post it, if that's the the function which causes the crash
 
Unfortunately I don't know what function updateDamage does. Can you post it, if that's the the function which causes the crash

Code:
function BossLoot:updateDamage()
    if self.creature then
        local tmp = {}
        local totaldmg = 0
        for killer, damage in pairs(self.creature:getDamageMap()) do
            totaldmg = totaldmg+damage.total
            tmp[killer] = damage.total
        end
        self.players = sort_descending(tmp)
        self.totaldmg = totaldmg
    else
        error("Creature not found.")
    end
end

I believe it is because the monster has no depot
 
Back
Top