• 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+ Is it possible to print [protection all] ( item attribute ) in lua?

Marko999x

I love highexp
Staff member
Board Moderator
Premium User
Joined
Dec 14, 2017
Messages
4,005
Solutions
107
Reaction score
3,175
Location
Germany
title says everything


1636127053524.png
 
Last edited:
Solution
This can serve as an example, but I have not really tried it
LUA:
local function getProtectionAll(item)
    local absorbPercents = item:getType():getAbilities()['absorbPercent']
    local count = absorbPercents[0]
    if count ~= 0 then
        for index = 1, 11 do
            if absorbPercents[index] ~= count then
                return 0
            end
        end
    end
    return count
end
local function getPlayerProtectionAll(player)
    local count = 0
    for slot = CONST_SLOT_HEAD, CONST_SLOT_AMMO do
        local item = player:getSlotItem(slot)
        if item then
            count = count + getProtectionAll(item)
        end
    end
    return count
end
This can serve as an example, but I have not really tried it
LUA:
local function getProtectionAll(item)
    local absorbPercents = item:getType():getAbilities()['absorbPercent']
    local count = absorbPercents[0]
    if count ~= 0 then
        for index = 1, 11 do
            if absorbPercents[index] ~= count then
                return 0
            end
        end
    end
    return count
end
local function getPlayerProtectionAll(player)
    local count = 0
    for slot = CONST_SLOT_HEAD, CONST_SLOT_AMMO do
        local item = player:getSlotItem(slot)
        if item then
            count = count + getProtectionAll(item)
        end
    end
    return count
end
 
Last edited:
Solution
Back
Top