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

Timed Lever problem.

teveldal

New Member
Joined
Sep 23, 2007
Messages
14
Reaction score
0
Location
Sweden. hstad
Hey!
I could use some help with my timed lever switch...
I made this script and it works if i set the timer low. The script is removing 2 walls and it's supposed to reset after 30 min but it only works with 1 min and maybe 5 min but when I try to set it to reset it after 20 min it stops working :(
I use tfs 0.3.5pl1.

So basically all i want this script to do is to remove 2 walls and reset after at least 30 min.

And I know this script sucks balls cuz im no scripter at all and if you feel like it you are welcome to optimize it


PHP:
--Script by LituM--

function onUse(cid, item, frompos, item2, topos)
---Config---
local stenpos1	= {x=606, y=339, z=13, stackpos=1} --cord on stone nr 1.
local stenpos2	= {x=519, y=337, z=13, stackpos=1} --cord on stone nr 2.
local stenID1	= 1551 --ID on stone nr 1.
local stenID2	= 1354 --ID on stone nr 2.
local timer	= 20 --Time in min.

	if item.itemid == 1945 then

		doRemoveItemFromPos(stenpos1, stenID1, 1)
		doRemoveItemFromPos(stenpos2, stenID2, 1)
		doPlayerSendTextMessage(cid,22,"Something has moved not too far away.")
		addEvent (reset, timer*1000*60)

	elseif item.itemid == 1946 then

		doPlayerSendCancel(cid, "Sorry, not possible.")
		return 1

	end

	return 0
end

function reset()
---Config---
local stenpos1	= {x=606, y=339, z=13, stackpos=1} --cord on stone nr 1.
local stenpos2	= {x=519, y=337, z=13, stackpos=1} --cord on stone nr 2.
local stenID1	= 1551 --ID on stone nr 1.
local stenID2	= 1354 --ID on stone nr 2.
local LeverPos	= {x=614, y=391, z=13} -- Lever cord
local stone1    = getThingfromPos(stenpos1)
local stone2    = getThingfromPos(stenpos2)
local Lever	= getTileItemById(LeverPos, 1946)

	if Lever.uid > 0 then

		doCreateItem(stenID1, 1, stenpos1)
		doCreateItem(stenID2, 1, stenpos2)
		doTransformItem(Lever.uid, 1945)

	return 0
	
	end

end
 
Back
Top