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

Set charges on rune! [SOLVED]

phil1p

beep beep im a jeep
Joined
Oct 29, 2009
Messages
77
Reaction score
0
As the title says, how can I set charges on the rune I get in the backpack?

get_id = id of the rune/potion you get when you pull the switch.


so it would be great if you could add like
Lua:
local charges = 10

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
        local container = 0
        local cost = 5000
        local get_id = 2268
        --> local charges = 10 <--
        local backpack_id = 2003
        if(item.itemid == 1945) then
                if(doPlayerRemoveMoney(cid, cost) == TRUE) then
                        doTransformItem(item.uid, item.itemid+1)
                        container = doPlayerAddItem(cid, backpack_id, 1)
                        for i = 1, 20 do
                                doAddContainerItem(container, get_id, --> charges <--)
                        end
                else
                        doPlayerSendCancel(cid,"Sorry, you don't have enough money.")
                end
        elseif(item.itemid == 1946) then
                doTransformItem(item.uid, item.itemid-1)
        end
return TRUE
end

Thanks on advance.

Solved, thanks to my brilliant brain!
 
Last edited:
PHP:
        sd_id = 2268 -- Item a ser vendido
        backpacksd_id = 2003 -- Backpack
		custosd_id = 6000 -- Valor
		cargassd_id = 3 -- Cargas

local name = getItemNameById(sd_id)
----- End Config -----
function onUse(cid, item, fromPosition, itemEx, toPosition)
        if doPlayerRemoveMoney(cid, custosd_id) == TRUE then
                local bag = doPlayerAddItem(cid, backpacksd_id, 1)
                        doSendAnimatedText(fromPosition, "Purchased", TEXTCOLOR_YELLOW)
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have purchased a backpack of ".. name .."s for ".. custosd_id .." gold.")
						for i=1,20 do
                        doAddContainerItem(bag, sd_id, cargassd_id)
                end
                else
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You need ".. custosd_id .." gold coins for a backpack of ".. name .."s.")
                end
        return FALSE
end
 
Back
Top