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

[REQUEST] Levers to buy POTS

dave182

New Member
Joined
Jan 23, 2009
Messages
80
Reaction score
3
Hi, I'm requesting a script for the action that u pull a lever and it gives u a backpack with POTS, because the one i have isn't working, I pull a lever and it just gives the backpack without potions inside. Look at this, for example, Great MP:

Code:
 function onUse(cid, item, fromPosition, itemEx, toPosition)

        -- by Maxi (Shawak)

        local config = {
                cost = 1000,
                item_id = 7591,
                backpack_id = 2001
        }

        local container = doPlayerAddItem(cid, config.backpack_id, 1)
        local itemweight = getItemWeight(config.item_id, 1)
        local playerCap = getPlayerFreeCap(cid)

        if doPlayerRemoveMoney(cid, config.cost) == TRUE then
                if playerCap >= itemweight then
                        if item.itemid == 1945 then
                                new_id = 1946
                        elseif item.itemid == 1946 then
                                new_id = 1945
                        end
                        doTransformItem(item.uid,new_id)
                        for i = 1, 20 do
                                doAddContainerItem(container, config_item_id, 1)
                                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You bought 1 "..getItemNameById(config.backpack_id).." of "..getItemNameById(config.item_id).." for "..config.cost.." gp.")
                        end
                else
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You need more free cap.")
                end
        else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You don't have enough money.")
        end
        return TRUE
end
 
I haven't checked the script yet but I'd like to ask you first... Are u sure u have enough money to buy the potions? Cuz when u don't, it gives an empty bp.
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)

        -- by Maxi (Shawak)

        local config = {
                cost = 1000,
                item_id = 7591,
                backpack_id = 2001
        }

        local container = doPlayerAddItem(cid, config.backpack_id, 1)
        local itemweight = getItemWeight(config.item_id, 1)
        local playerCap = getPlayerFreeCap(cid)

        if doPlayerRemoveMoney(cid, config.cost) == TRUE then
                if playerCap >= itemweight then
                        if item.itemid == 1945 then
                                new_id = 1946
                        elseif item.itemid == 1946 then
                                new_id = 1945
                        end
                        doTransformItem(item.uid,new_id)
                        for i = 1, 20 do
                                doAddContainerItem(container, config_item_id, 1)
                        end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You bought 1 "..getItemNameById(config.backpack_id).." of "..getItemNameById(config.item_id).." for "..config.cost.." gp.")
                else
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You need more free cap.")
                end
        else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You don't have enough money.")
        end
        return TRUE
end
Try this one, or the other they i've posted you, and stop spamming, thanks :thumbup:.

Regards,
Shawak
 
It gives me error

[21/08/2009 10:44:11] Lua Script Error: [Action Interface]
[21/08/2009 10:44:11] data/actions/scripts/lever potions/potis.lua:eek:nUse

[21/08/2009 10:44:11] data/actions/scripts/lever potions/potis.lua:16: attempt to compare boolean with number
[21/08/2009 10:44:11] stack traceback:
[21/08/2009 10:44:11] data/actions/scripts/lever potions/potis.lua:16: in function <data/actions/scripts/lever potions/potis.lua:1>
 
Back
Top