• 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 an item

Rexanilator

New Member
Joined
Oct 3, 2009
Messages
297
Reaction score
2
I am looking for a code that would allow several items to be placed on tiles and then pull the lever and get a different item...for example, helmet of the ancients...all pieces laid on each tile and then switch gives the helmet.

thanks!
 
Code:
local t = {
	{ [B][COLOR="red"]{x=100, y=100, z=7}[/COLOR][/B], [B][COLOR="red"]1234[/COLOR][/B]},
	{ [B][COLOR="red"]{x=101, y=101, z=7}[/COLOR][/B], [B][COLOR="red"]5678[/COLOR][/B]},
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		local k = {}
		for i = 1, #t do
			local v = getTileItemById(t[i][1], t[i][2]).uid
			if v == 0 then
				return doPlayerSendCancel(cid, 'Some items are missing.')
			else
				table.insert(k, v)
			end
		end
		for i = 1, #k do
			doSendMagicEffect(t[i][1], [B][COLOR="red"]CONST_ME_MAGIC_RED[/COLOR][/B])
			doRemoveItem(k[i])
		end
		doCreateItem([B][COLOR="red"]2468[/COLOR][/B], [B][COLOR="red"]1[/COLOR][/B], [B][COLOR="red"]{x=105, y=105, z=7}[/COLOR][/B])
		doSendMagicEffect([B][COLOR="red"]{x=105, y=105, z=7}[/COLOR][/B], [B][COLOR="red"]CONST_ME_MAGIC_GREEN[/COLOR][/B])
	end
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
 
Back
Top