• 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] Advanced buying via switches

Ernii

New Member
Joined
Oct 19, 2008
Messages
169
Reaction score
1
Could someone make for me a working buying via switches under TFS 0.3.4 CD ?
I need that i can buy runes like sd with 10 charges in a backpack.
You can post me a example i will make all runes

Rep++
 
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
 
Back
Top