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

Action Lever Rune(s) System

Wow, why are so many people trying to insult JDB so much? He makes good scripts, and instead of being negative you can try to be more positive and write good stuff instead of bad, or write bad stuff but in a good way.

Signed
 
Update

Code:
local weight = 56.24234
return string.format("%.2f", weight)

Sorry, you need 56.24 oz to carry this.
 
Check mine one (It's a mod)
Lua:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Buy item by lever" version="1.0" author="Darkhaos" contact="otland.net" enabled="yes">
	<config name="switch_items"><![CDATA[
		uid = {
			[5556] = {item = 2273, count = 1, charges = 2, cost = 50, backpack = false, backpackID = 0, ignoreCap = true},
			[5557] = {item = 2313, count = 1, charges = 3, cost = 200, backpack = false, backpackID = 0, ignoreCap = true},
			[5558] = {item = 2268, count = 1, charges = 3, cost = 250, backpack = false, backpackID = 0, ignoreCap = true},
			[5559] = {item = 2293, count = 1, charges = 3, cost = 200, backpack = false, backpackID = 0, ignoreCap = true},
			[5560] = {item = 2311, count = 1, charges = 10, cost = 75, backpack = false, backpackID = 0, ignoreCap = true},
			[5561] = {item = 2304, count = 1, charges = 4, cost = 150, backpack = false, backpackID = 0, ignoreCap = true},
			[5562] = {item = 2006, count = 1, charges = 7, cost = 110, backpack = false, backpackID = 0, ignoreCap = true},
			[5563] = {item = 7620, count = 20, charges = 1, cost = 1000, backpack = true, backpackID = 2001, ignoreCap = true},
			[5564] = {item = 2273, count = 20, charges = 2, cost = 1000, backpack = true, backpackID = 2002, ignoreCap = true},
			[5565] = {item = 2268, count = 20, charges = 3, cost = 5000, backpack = true, backpackID = 2003, ignoreCap = true},
			[5566] = {item = 2293, count = 20, charges = 3, cost = 4000, backpack = true, backpackID = 1999, ignoreCap = true},
			[5567] = {item = 2311, count = 20, charges = 10, cost = 1500, backpack = true, backpackID = 2001, ignoreCap = true},
			[5568] = {item = 2313, count = 20, charges = 3, cost = 4000, backpack = true, backpackID = 2001, ignoreCap = true},
			[5569] = {item = 2304, count = 20, charges = 4, cost = 3000, backpack = true, backpackID = 2000, ignoreCap = true},
			[5570] = {item = 3940, count = 1, charges = 1, cost = 20, backpack = false, backpackID = 0, ignoreCap = true},
			[5571] = {item = 2006, count = 1, charges = 7, cost = 110, backpack = false, backpackID = 0, ignoreCap = true},
			[5572] = {item = 2006, count = 1, charges = 7, cost = 110, backpack = false, backpackID = 0, ignoreCap = true}
		}
 
		levers = {
			1945,
			1946
		}
	]]></config>
	<action fromuid="5556" touid="5572" event="buffer"><![CDATA[
	domodlib('switch_items')
 
	if isInArray(levers, item.itemid) then
		doTransformItem(item.uid, (item.itemid == 1945 and 1946 or 1945)) 
		local item = uid[item.uid]
		if item then
			if item.backpack then
				if getPlayerMoney(cid) < item.cost then
					doPlayerSendCancel(cid, "You need " .. item.cost .. " gold coins to buy a backpack of " .. getItemNameById(item.item) .. ".")
					doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
					return true
				end
 
				if not item.ignoreCap and getPlayerFreeCap(cid) < (getItemWeightById(item.backpackID, item.backpackCount) + getItemWeightById(item.item, item.count)) then
					doPlayerSendCancel(cid, "You don't have enough cap.")
					doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
					return true
				end
 
				local deny = false
				if not isItemContainer(item.backpackID) then deny = true end
				if not deny then
					local container = doPlayerAddItem(cid, item.backpackID, 1)
					for i = 1, item.count do
						doAddContainerItem(container, item.item, item.charges)
					end
					doPlayerRemoveMoney(cid, item.cost)
					doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You bought " .. item.count .. "x " .. getItemNameById(item.item) .. (item.count > 1 and "s" or "") .. ".")
					doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
				else
					error("[Warning - Error] Cannot add items in container id " .. item.backpackID .. ".")
				end
			else
				if getPlayerMoney(cid) < item.cost then
					doPlayerSendCancel(cid, "You need " .. item.cost .. " gold coins to buy " .. getItemArticleById(item.item) .. " " .. getItemNameById(item.item) .. ".")
					doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
					return true
				end
 
				if not item.ignoreCap and getPlayerFreeCap(cid) < getItemWeightById(item.item, item.count) then
					doPlayerSendCancel(cid, "You don't have enough cap.")
					doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
					return true
				end
 
				for i = 1, item.count do
					doPlayerAddItem(cid, item.item, item.charges)
				end
				doPlayerRemoveMoney(cid, item.cost)
				doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You bought " .. item.count .. "x " .. getItemNameById(item.item) .. (item.count > 1 and "s" or "") .. ".")
				doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_GREEN)
			end
		end
	end
	]]></action>
</mod>
 
It has been a while since this was bumped and I still see requests for it.

So...bump. :p
 
Back
Top