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

Bp of Runes Lever

krec

New Member
Joined
Jun 28, 2008
Messages
30
Reaction score
0
How I can add price on this script for works on TFS 0.3.4?

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
    if item.itemid == 1945 then
        addContainerWithItems(cid, 2002, 2273, 255, 20)
        doTransformItem(item.uid,item.itemid+1)
    elseif item.itemid == 1946 then
        addContainerWithItems(cid, 2002, 2273, 255, 20)
        doTransformItem(item.uid,item.itemid-1)
    else
        doPlayerSendCancel(cid,"Sorry, not possible.")
    end
return 1
end

function addContainerWithItems(cid, container, item, item_count, count)
Container = doPlayerAddItem(cid, container, 1)
    for i = 1, count do
        doAddContainerItem(Container, item, item_count)
    end
end
 
Last edited:
//100% by pitufo.


Lua:
--Advanced container lever ( By Pitufo)
local items = {
    [9000] = {itemId=2308, contMax=20, bp=2000, cost=4000, charges=2}, 
}
function onUse(cid, item, frompos, item2, topos)
    if items[item.uid] then
        if item.itemid == 1512 then
            local v = items[item.uid]
                if getPlayerFreeCap(cid) >= getItemWeightById(v.itemId, 20) then
                    if doPlayerRemoveMoney(cid, v.cost) == TRUE then
                    container = doPlayerAddItem(cid, v.bp, 1)
                        for i = 1, v.contMax do
                        if not(isItemRune(v.itemId)) then
                            doAddContainerItem(container, v.itemId, 1)
                            else
                            doAddContainerItem(container, v.itemId, v.charges)
                            end
                        end    
                            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have but a container with "..getItemNameById(v.itemId)..".")
                    else 
                        doPlayerSendCancel(cid, "Sorry, not enough money [Cost: "..v.cost.."].")
                    end    
                else 
                    doPlayerSendCancel(cid, "Not enough cap [Cap needed: "..getItemWeightById(v.itemId, 20).."].")
                end    
                doTransformItem(item.uid, item.itemid-1)
            elseif item.itemid == 1945 then
                doTransformItem(item.uid, item.itemid+1)
        end
    end    
return 1
end
 
Lua:
local CONFIG = {
    [1526]={backpack_id = 2002, item_id = 2273, charges = 2, cost = 2000}, -- ultimate healing rune
    [1525]={backpack_id = 1999, item_id = 2293, charges = 3, cost = 1000}, -- magic wall rune
    [1524]={backpack_id = 2001, item_id = 2313, charges = 6, cost = 1200}, -- explosion rune
    [1523]={backpack_id = 2003, item_id = 2268, charges = 3, cost = 2000}, -- sudden death rune
    [1522]={backpack_id = 2000, item_id = 8473, charges = 1, cost = 2200}, -- ultimate health potion
    [1521]={backpack_id = 1988, item_id = 8472, charges = 1, cost = 2200}, -- great spirit potion    
    [1520]={backpack_id = 2000, item_id = 7591, charges = 1, cost = 1800}, -- great health potion
    [1519]={backpack_id = 2000, item_id = 7588, charges = 1, cost = 1000}, -- strong health potion    
    [1518]={backpack_id = 2000, item_id = 7618, charges = 1, cost = 800},  -- health potion 
    [1517]={backpack_id = 2001, item_id = 7590, charges = 1, cost = 2200}, -- great mana potion
    [1516]={backpack_id = 2001, item_id = 7589, charges = 1, cost = 1000}, -- strong mana potion
    [1515]={backpack_id = 2001, item_id = 7620, charges = 1, cost = 800}   -- mana potion
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	local container = 0
 	if item.itemid == 1945 then	
		if doPlayerRemoveMoney(cid, CONFIG[item.actionid].cost) == TRUE then
	    	doTransformItem(item.uid, item.itemid+1)
		     container = doPlayerAddItem(cid, CONFIG[item.actionid].backpack_id, CONFIG[item.actionid].charges)
		        for i = 1, 20 do
				    doAddContainerItem(container, CONFIG[item.actionid].item_id)
                end
        else
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You don't have enough money. The price is "..CONFIG[item.actionid].cost.." gold pieces.") 
		end
 	elseif item.itemid == 1946 then
		    doTransformItem(item.uid, item.itemid-1)
	end
  return TRUE
end

bye :)
 
Dont working in TFS 0.3.4

Say: "You don't have enough money. The price is 2200 gold pieces."

and I have money...
Whats is the problem?
 
I'm using TFS 0.3.4
and dont working... (I have updated everything)

josejunior23 you can enter in my server?
for you look runes lever...
 
Back
Top