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

Solved player check cap and cointainers

silveralol

Advanced OT User
Joined
Mar 16, 2010
Messages
1,484
Solutions
9
Reaction score
217
SOLVED!

hello folks, I'm trying figure out how check the capacity the player, to give or not a item to him, but I don't know how make it, I try it:
Code:
    local cap = player:getFreeCapacity()
    if cap > itemType:getWeight() then
        bag:addItem(itemType:getId(), 1, INDEX_WHEREEVER, FLAG_NOLIMIT)
    else
       -- some code msg
    end
thanks in advice.
 
Last edited:
yes, solved...I use it:
Code:
local weight = itemType:getWeight()
if player:getFreeCapacity() < weight then
 --- return error
end
I'm using tfs 1.2!
 
Back
Top