• 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 Lever Problem HELP

destroyer667

Member
Joined
Nov 21, 2007
Messages
290
Reaction score
6
How can i make this lever so that when you use it once you cant move it back and that it will reset on its own so ppl can redo the quest in 3 minutes? for some reason its not working for me


LUA:
local m, n = {x=33382, y=31591, z=15, stackpos=1}, {x=33384, y=31593, z=15}
local f = function (p)
	doCreateItem(1353, 1, n)
	doTransformItem(getTileItemById(p, 1946).uid, 1945)
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		local a = getThingfromPos(m)
		if a.itemid == 2916 then
			doTransformItem(item.uid, 1946)
			doRemoveItem(a.uid)
			doRemoveItem(getTileItemById(n, 1353).uid)
			doSendMagicEffect(m, CONST_ME_MAGIC_RED)
			doSendMagicEffect(n, CONST_ME_MAGIC_RED)
			addEvent(f, 3 * 60000, fromPosition)
		else
			doPlayerSendCancel(cid, 'You must figure out what you need to place on the tile!')
		end
	else
		doPlayerSendCancel(cid, 'You must wait for the lever to reset.')
	end
	return 1
end

Thanks to Cykotitan this is a 100% working script for Avesta 7.6
 
Last edited:
im pretty sure you helped me with it the other day :/ unless im mistaken sorry if i am!


EDIT: ahh right you helped me with my npc. Sorry :] anyways still looking for some help +rep!
 
Last edited:
LUA:
local m, n = {x=33382, y=31591, z=15, stackpos=1}, {x=33384, y=31593, z=15}
local f = function (p)
	doCreateItem(1353, 1, n)
	doTransformItem(getTileItemById(p, 1946).uid, 1945)
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		local a = getThingfromPos(m)
		if a.itemid == 2916 then
			doTransformItem(item.uid, 1946)
			doRemoveItem(a.uid)
			doRemoveItem(getTileItemById(n, 1353).uid)
			doSendMagicEffect(m, CONST_ME_TELEPORT)
			doSendMagicEffect(n, CONST_ME_TELEPORT)
			addEvent(f, 3 * 60000, fromPosition)
		else
			doPlayerSendCancel(cid, 'You must figure out what you need to place on the tile!')
		end
	else
		doPlayerSendCancel(cid, 'Sorry, not possible.')
	end
	return true
end
 
Thanks! script works really well but i have 1 small request so it doesn't get bugged out

players can still use the lever feely after they use it like they can move it back and forth, would u beable to make it so that when they use the lever 1 time they arnt able to move it again until the lever resets it self back to normal. (when they try to use the lever "Sorry you must wait until this lever resets!")

Oh also which isn't a big deal when you push the lever with the item on the tile it doesn't change from "1945" to "1946" until the item is gone and you move it again

LUA:
local m, n = {x=33382, y=31591, z=15, stackpos=1}, {x=33384, y=31593, z=15}
local f = function (p)
	doCreateItem(1353, 1, n)
	doTransformItem(getTileItemById(p, 1946).uid, 1945)
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		local a = getThingfromPos(m)
		if a.itemid == 2916 then
			doTransformItem(item.uid, 1946)
			doRemoveItem(a.uid)
			doRemoveItem(getTileItemById(n, 1353).uid)
			doSendMagicEffect(m, CONST_ME_TELEPORT)
			doSendMagicEffect(n, CONST_ME_TELEPORT)
			addEvent(f, 1 * 60000, fromPosition)
		else
			doPlayerSendCancel(cid, 'You must figure out what you need to place on the tile!')
		end
	else
		doPlayerSendCancel(cid, 'Sorry, not possible.')
	end
	return true
end
 
im using avesta 7.6 server v4 thats probably why

not that big of a deal i guess atleast it works!! thanks alot you're amazing at scripting ^^ i gave you all the rep i could until next time.
 
Haha yep that was it works 100% now thanks alot your work is very very much appreciated i've been searching and trying my self to figure out this script for the past 3 hours :]

Replaced my first script with the full working one if anyone needs it
 
Back
Top