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

Why this 'addevent' don't works? (Solved)

LucasFerraz

Systems Analyst
Joined
Jun 10, 2010
Messages
2,857
Reaction score
96
Location
Brazil
I made this lever of Banshee Quest, why this 'addevent' don't works?
LUA:
function onUse(cid, item, frompos, item2, topos)

pausa = 10
pausa1 = 11
wall0 = {x=32259, y=31891, z=10, stackpos=1}
getwall0 = getThingfromPos(wall0)
wall1 = {x=32259, y=31890, z=10, stackpos=1}
getwall1 = getThingfromPos(wall1)

if item.itemid == 1945 and getwall0.itemid == 1498 then
doRemoveItem(getwall0.uid,1)
doTransformItem(item.uid,1946)
addEvent(wait1,pausa,getwall0pos)
addEvent(wait1,pausa1,getwall1pos)
elseif item.itemid == 1946 then
doTransformItem(item.uid,1945)
end
return 0
end
 
LUA:
addEvent(doCreateItem, pausa*1000, getwall0.itemid, 1, getThingPosition(getwall0.uid))
that should work. do the same for getwall1.

also add:
LUA:
doRemoveItem(getwall1.uid)
You forgot it.
 
LUA:
local f, e = function(p)
	doRelocate({x=32259, y=31890, z=10}, {x=32259, y=31892, z=10})
	doRelocate({x=32259, y=31891, z=10}, {x=32259, y=31892, z=10})
	doCreateItem(1498, 1, {x=32259, y=31890, z=10})
	doCreateItem(1498, 1, {x=32259, y=31891, z=10})
	doTransformItem(getTileItemById(p, 1946).uid, 1945)
end, 0

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		doRemoveItem(getThingfromPos({x=32259, y=31890, z=10, stackpos=254}).uid)
		doRemoveItem(getThingfromPos({x=32259, y=31891, z=10, stackpos=254}).uid)
		e = addEvent(f, 60000, fromPosition)
		doTransformItem(item.uid, 1946)
	else
		stopEvent(e)
		e = 0
		f(fromPosition)
	end
	return true
end
 
Back
Top