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

Switch for buy Runes.

RunarM

Finally back
Joined
Jul 17, 2008
Messages
1,636
Reaction score
32
Location
Norway/Tromsø
Im looking for a script or something for my ots =)

Its like You buy things with Switch.

1945 -> 1946

Like this:::

likethis.jpg
 
2 sec.

EDIT: Think this one will work. Just put different actionIDs on every switch, and assign an itemID and price to them.

Code:
local buyItem = 0
local price = 0

function onUse(cid, item, frompos, topos)

	local money = crystalCoins * 10000 + platinumCoins * 100 + goldCoins

	if item.actionId == 12345 then
		buyItem = ITEMID --(CHANGE)
		price = 1000 -- 1000 gp (CHANGE)
	elseif item.actionId == 12346 then
		buyItem = ITEMID2 --(CHANGE)
		price = 1000 -- 1000 gp (CHANGE)	
	elseif item.actionId == 12347
		buyItem = ITEMID3 --(CHANGE)
		price = 1000 -- 1000 gp (CHANGE)		
	end
	
	
	if item.itemid == 1945 then
		if money >= price then
			doPlayerAddItem(cid,buyItem,1)
			doPlayerRemoveMoney(cid,price)
			doTransformItem(item.uid,item.itemid + 1)
		else
			doPlayerSendTextMessage(cid,22,"You can't afford this.")
		end
	else
		doTransformItem(item.uid,item.itemid - 1)
	end
end
 
Last edited:
Code:
function onUse(cid, item)
	if item.itemid == 1945 and item.actionid == 124214124 then
		if doPlayerRemoveMoney(cid, 5000) == TRUE then
			local container = doPlayerAddItem(cid, 2004, 1)
			for i = 1, 20 do
				doAddContainerItem(container, itemid, 1)
			end
		else
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "You do not have enough money.")
		end
	end
	return TRUE
end

If you want the lever to be transforming into the other lever add it yourself ^^
 
data/actions/scripts/other/whatever.lua

in data/actions/actions.xml add:
<action actionid="youchoose" script="other/whatever.lua"/>

In the file edit actionid and itemid in the doAddContainer function. Try adding yourself other things to buy in this script.
 
Back
Top