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

Lua Action of gate :)

Discovery

Developing myself
Joined
Apr 16, 2010
Messages
562
Solutions
11
Reaction score
261
Location
Neverland
Hello Guys! I need help.

I want the lever, create and remove it in two places. = (

My script!

local gatepos = {x=9845, y=10284, z=15, stackpos=1}

function onUse(cid, item, frompos, item2, topos)
local getgate = getThingfromPos(gatepos)

if item.itemid == 1945 and getgate.itemid == 1355 then
doRemoveItem(getgate.uid, 1)
doTransformItem(item.uid, item.itemid+1)
elseif item.itemid == 1946 and getgate.itemid == 0 then
doCreateItem(1355, 1, gatepos)
doTransformItem(item.uid, item.itemid-1)
else
doPlayerSendCancel(cid,"Sorry, not possible.")
end
return 1
end
 
LUA:
local t = {
	{x=9845, y=10284, z=15},
	{x=9846, y=10284, z=15}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local a = item.itemid == 1945
	for i = 1, #t do
		if a then
			doRemoveItem(getTileItemById(t[i], 1355).uid)
		else
			doCreateItem(1355, 1, t[i])
		end
	end
	return doTransformItem(item.uid, a and 1946 or 1945)
end
 
LUA:
local t = {
	{x=9845, y=10284, z=15},
	{x=9846, y=10284, z=15}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local a = item.itemid == 1945
	for i = 1, #t do
		if a then
			doRemoveItem(getTileItemById(t[i], 1355).uid)
		else
			doCreateItem(1355, 1, t[i])
		end
	end
	return doTransformItem(item.uid, a and 1946 or 1945)
end


Hey, very good! Thanks so much. =)
 
Back
Top