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

Lua [1.3] stack all items

Nokturno

Not a human
Joined
Aug 7, 2009
Messages
496
Solutions
2
Reaction score
358
hello Im using this module wich stacks items based on itemID,
is there a way to change this into all stackable items and not just by filter


Lua:
function onExtendedOpcode(player, opcode, buffer)
        local buf = tonumber(buffer)
    if opcode == 141 and buf == 1 then
        local coppercount = player:getItemCount(2148)
        local silvercount = player:getItemCount(2152)
        local goldcount = player:getItemCount(2160)
        local diamondcount = player:getItemCount(2151)
        local upgradeorb = player:getItemCount(29032)
    

    if coppercount >= 100 then
        local getcoppercount = (math.floor((coppercount / 100)))
    player:addItem(2152, getcoppercount)
    player:removeItem(2148, (getcoppercount * 100))
        else
    player:removeItem(2148, coppercount)
    player:addItem(2148, coppercount)
        end

    if silvercount >= 100 then
        local getsilvercount = (math.floor((silvercount / 100)))
    player:addItem(2160, getsilvercount)
    player:removeItem(2152, (getsilvercount * 100))
        else
    player:removeItem(2152, silvercount)
    player:addItem(2152, silvercount)
        end

    if goldcount >= 100 then
        local getgoldcount = (math.floor((goldcount / 100)))
    player:addItem(2151, getgoldcount)
    player:removeItem(2160, (getgoldcount * 100))
        else
    player:removeItem(2160, goldcount)
    player:addItem(2160, goldcount)
        end

    if diamondcount > 1 then
    player:removeItem(2151, diamondcount)
    player:addItem(2151, diamondcount)
        end
    
     if upgradeorb >= 1 then
    player:removeItem(29032, upgradeorb)
    player:addItem(29032, upgradeorb)
        end
        
        
            return
    end
end
 
Top