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

[REQUEST] Lever REP +

Jair94

New Member
Joined
Oct 23, 2008
Messages
9
Reaction score
0
Hello, i need a script for a lever to make a wall dissappear and when the lever go back to the original place the wall appear again. can someone help me? i use TFS 8.52.

REP +
 
Not tested

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local wall, w_id = { x = 100, y= 100, z = 7, stackpos = 1 }, { 1050 }
	if(item.itemid == 1945) then
		if(getThingfromPos(wall).itemid == w_id) then
                        doRemoveItem(getThingfromPos(wall).uid)
		end
	elseif(item.itemid == 1946) then
		doCreateItem(w_id, wall, 1)
	end
	return true
end
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local wall, w_id = { x = 100, y= 100, z = 7, stackpos = 1 }, { 1050 }
	if(item.itemid == 1945) then
		if(getThingfromPos(wall).itemid == w_id) then
                        doRemoveItem(getThingfromPos(wall).uid)
		end
	elseif(item.itemid == 1946) then
		doCreateItem(w_id, wall, 1)
	end
	return true
end

Will this works when w_id is a table value?
Lua:
if(getThingfromPos(wall).itemid == w_id) then

maybe (to use a table)
Lua:
if isInArray(w_id, getThingfromPos(wall).itemid) then
 
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local wall, w_id = { x = 100, y= 100, z = 7, stackpos = 1 }, 1050
	if(item.itemid == 1945) then
		if(getThingFromPos(wall).itemid == w_id) then
                        doRemoveItem(getThingFromPos(wall).uid)
		end
	elseif(item.itemid == 1946) then
		doCreateItem(w_id, wall, 1)
	end
	return true
end

or

Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local wall, w_id = { x = 100, y= 100, z = 7, stackpos = 1 }, 1050
	if(item.itemid == 1945) then
		if(getThingfromPos(wall).itemid == w_id) then
                        doRemoveItem(getThingfromPos(wall).uid)
		end
	elseif(item.itemid == 1946) then
		doCreateItem(w_id, wall, 1)
	end
	return true
end
 
Code:
local wall, w_id = {x = 100, y= 100, z = 7}, 1050
function onUse(cid, item, fromPosition, itemEx, toPosition)
return
	TRUE,
	item.itemid == 1945
	and
		doRemoveItem(getTileItemById(wall, w_id).uid)
	or
	item.itemid == 1946
	and
		doCreateItem(w_id, 1, wall)
end
 
Code:
local wall, w_id = {x = 100, y= 100, z = 7}, 1050
function onUse(cid, item, fromPosition, itemEx, toPosition)
return
	TRUE,
	item.itemid == 1945
	and
		doRemoveItem(getTileItemById(wall, w_id).uid)
	or
	item.itemid == 1946
	and
		doCreateItem(w_id, 1, wall)
end

oOoOoOoOoOoooOOOooOOooOo wtf :eek: :p
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local w_pos, w_id = { x = 100, y= 100, z = 7 }, { 1050 }
	if(item.itemid == 1945) then
		local wall = getTileItemById(w_pos, w_id)
		if([B][COLOR="Red"]wall < 1[/COLOR][/B]) then
                        doCreateItem(w_id, 1, w_pos)
		else
			doRemoveItem(wall.uid)
		end
	elseif(item.itemid == 1946) then
		doSendMagicEffect(fromPosition, CONST_ME_POFF)
	end
	return true
end
attempt to compare table with number

Replace wall with wall.uid
 
0.3.6pl1

@Up,
Oops. :thumbup:

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local w_pos, w_id = { x = 100, y= 100, z = 7 }, { 1050 }
	if(item.itemid == 1945) then
		local wall = getTileItemById(w_pos, w_id)
		if(wall.uid < 1) then
                        doCreateItem(w_id, 1, w_pos)
		else
			doRemoveItem(wall.uid)
		end
	elseif(item.itemid == 1946) then
		doSendMagicEffect(fromPosition, CONST_ME_POFF)
	end
	return true
end
 
Last edited:
Back
Top