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

Create Item whit [TABLE]

Wifixs

New Member
Joined
Jul 20, 2009
Messages
18
Reaction score
1
@ Cykotitan

Very thanks man....
worck perfectly

Lua:
local t = {
	levers = {
		{x=106, y=136, z=7, stackpos = 1},
		{x=109, y=133, z=7, stackpos = 1},
		{x=113, y=136, z=7, stackpos = 1},
		{x=109, y=140, z=7, stackpos = 1}
	},
	walls = { 
-- horizontals of coordinate 1 to the 6, from the 7 to the 12 vertical 
-- electric iron bars (horizontals 5071, verticals 5072).... 
	{x=109, y=135, z=7},  --   1
	{x=110, y=135, z=7},  --   2
        {x=111, y=135, z=7},  --   3
        {x=109, y=138, z=7},  --   4
        {x=110, y=138, z=7},  --   5
        {x=111, y=138, z=7},  --   6    
	{x=108, y=136, z=7},  --   7
	{x=108, y=137, z=7},  --   8
	{x=108, y=138, z=7},  --   9
        {x=111, y=136, z=7},  --   10
        {x=111, y=137, z=7},  --   11
        {x=111, y=138, z=7}   --   12
	},
	monsters = {
		"Dragon",
		"Dragon",
		"Dragon"
	}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		if item.actionid == 8787 then
			for i = 1, #t.levers do
				if getThingfromPos(t.levers[i]).itemid == 1946 then
					failed = true
					break
				end
			end
			if not failed then
				for i = 1, #t.walls do
					doCreateItem(i < 7 and 5071 or 5072, 1, t.walls[i])
				end
				for i = 1, #t.monsters do
					doSummonCreature(t.monsters[i], fromPosition)
				end
			else
				doPlayerSendCancel(cid, "You need to pull the other levers first.")
				return TRUE
			end
		end
		doTransformItem(item.uid,item.itemid+1)
	elseif item.itemid == 1946 and item.actionid == 8787 then
        doTransformItem(item.uid,item.itemid-1)
	end
	return TRUE
end
 
Last edited:
Because you've defined several variables that have the same index. Please explain precisely what you want the script to do.
 
First put the 4 switch in the correct position (1945), after that do you can to drive the switch with action you go 8787 this would create items forming a jail, simultaneously would create monsters within the jail, when monsters dies was created a telepor with which to leave...

dibujoiuz.jpg
 
Code:
local t = {
	levers = {
		{x=100, y=100, z=7},
		{x=100, y=100, z=7},
		{x=100, y=100, z=7},
		{x=100, y=100, z=7}
	},
	walls = {
		{x=109, y=138, z=7},
		{x=110, y=138, z=7},
		{x=111, y=137, z=7},
		{x=111, y=136, z=7},
		{x=108, y=136, z=7},
		{x=108, y=137, z=7},
		{x=111, y=137, z=7},
		{x=111, y=136, z=7}
	},
	monsters = {
		"Dragon",
		"Dragon",
		"Dragon"
	}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		if item.actionid == 8787 then
			for i = 1, #t.levers do
				if getTileItemById(t.levers[i], 1946).uid < 1 then
					failed = true
					break
				end
			end
			if not failed then
				for i = 1, #t.walls do
					doCreateItem(i < 5 and 5071 or 5072, 1, t.walls[i])
				end
				for i = 1, #t.monsters do
					doSummonCreature(t.monsters[i], fromPosition)
				end
			else
				doPlayerSendCancel(cid, "You need to pull the other levers first.")
				return TRUE
			end
		end
		doTransformItem(item.uid,  1946)
	elseif item.actionid == 10284 and item.itemid == 1946 then
		doTransformItem(item.uid,item.itemid-1)
	end
	return TRUE
end
 
Back
Top