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

little problem with lever script

izaak

New Member
Joined
Feb 1, 2009
Messages
161
Reaction score
3
i have a question , i am using this script and it works for me it gives me 1 stack of 100 sd's
but how can i make it give me 20 stacks of sd?

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    local shop = {
        [1000] = {
            rune = 2268, container = 2003, cost = 5000, charges = 100, effect = CONST_ME_GIFT_WRAPS
        },
        [1015] = {
            rune = 2269, container = 2002, cost = 3000, charges = 3, effect = CONST_ME_GIFT_WRAPS
        }
    }
    local v = shop[item.actionid]
    local weight = getItemWeightById(v.container, getContainerSize(v.container)) + getItemWeightById(v.container, 1)                   
    if(getPlayerFreeCap(cid) >= weight) then
        if(getPlayerMoney(cid) >= v.cost) then
            local bp = doCreateItemEx(cid, v.container, 1)
            doAddContainerItem(bp, v.rune, v.charges)
            if(doPlayerAddItemEx(cid, bp, true) ~= RETURNVALUE_NOERROR) then
                doPlayerSendCancel(cid, "Sorry, you do not have enough space.")
            else
                doPlayerRemoveMoney(cid, v.cost)
                doSendMagicEffect(getThingPos(cid), v.effect)
                doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have purchased a backpack of " .. getItemNameById(v.rune) .. "'s.")
            end
        else
            doPlayerSendCancel(cid, "Sorry, you must have " .. v.cost .. " gold.")
        end
    else
        doPlayerSendCancel(cid, "Sorry, you need " .. math.ceil(weight) .. "oz. to carry this item.")
    end
    return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
 
yes that worked thanks so much :D
if you need to make them not stack you can use this:

Code:
while getContainerSize(bp.uid) < getContainerCap(bp.uid) do
   doTransformItem(doAddContainerItem(bp.uid, 1635), v.rune, v.charges)
end

this will create a heart pillow and transform it so when having something less than 100 they wont stack and it will fill up the bp with specified charges
 
thank you very much, i needed them to stack for bp runes , but il keep that part to incase i might need it soon :D
 
Back
Top