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

lever with timer?

hepy

New Member
Joined
Aug 15, 2007
Messages
217
Reaction score
1
Hi i need some help with a script :)
how to make that when i use a lever, a stone in a certain position dissapear, and after 5min this stone automatically appears in that certain position? and also checks a certain area and clean all monsters inside
thanks!
 
Lua:
local t, event = {
	id = 1304,
	pos = {x=100, y=100, z=7},
	from = {x=550, y=500, z=7},
	to = {x=700, y=600, z=7},
	time = 5 * 60 * 1000
}, 0

local function reset(p)
	doTransformItem(getTileItemById(p, 1946).uid, 1945)
	doCreateItem(t.id, 1, t.pos)
	for x=t.from.x, t.to.x do
		for y=t.from.y, t.to.y do
			for z=t.from.z, t.to.z do
				local v = getTopCreature({x=x, y=y, z=z}).uid
				if isMonster(v) then
					doRemoveCreature(v)
				end
			end
		end
	end
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		doRemoveItem(getTileItemById(t.pos, t.id).uid)
		event = addEvent(reset, t.time, toPosition)
		doTransformItem(item.uid, 1946)
	else
		stopEvent(event)
		reset(toPosition)
	end
	return true
end
 
Back
Top