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

add in delay for stone to come back

Ziggy

Member
Joined
Aug 11, 2007
Messages
49
Reaction score
6
Here is my script for removing a stone with a lever

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
stone = {x=1009, y=1020, z=6, stackpos=2} -- pos of stone
getstone = getThingfromPos(stone)

if item.uid == 20010 and item.itemid == 1945 then -- the item uid
doRemoveItem(getstone.uid,1)
doTransformItem(item.uid,item.itemid+1)
setPlayerStorageValue(cid, 20009, 2)
elseif item.itemid == 1946 then
doTransformItem(item.uid,item.itemid-1)
else
doPlayerSendCancel(cid,"Sorry, not possible.")
end
return 1
end

can someone help me out and add in a delay for like 5 minutes and then the stone comes back?
 
LUA:
local pos = {x=1009, y=1020, z=6}
local reset, event = function(leverPos)
	doCreateItem(1304, 1, pos)
	doTransformItem(getTileItemById(leverPos, 1946).uid, 1945)
end, 0

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then -- the item uid
		doRemoveItem(getTileItemById(pos, 1304).uid)
		doTransformItem(item.uid, 1946)
		if getPlayerStorageValue(cid, 20009) < 2 then
			setPlayerStorageValue(cid, 20009, 2)
		end
		event = addEvent(reset, 5 * 60 * 1000, fromPosition)
	else
		stopEvent(event)
		reset(fromPosition)
	end
	return true
end
 
Im getting this error

[27/11/2010 09:59:46] [Error - Action Interface]
[27/11/2010 09:59:46] data/actions/scripts/quests/minolever.lua:onUse
[27/11/2010 09:59:46] Description:
[27/11/2010 09:59:46] (luaDoRemoveItem) Item not found

nevermind about that error, now its not giving me an error its just not taking the stone away, does the stone require a unique id and if so where do I put it in the code?

I tried editing it all that I could but I could just not get it to take the stone away.
 
Last edited:
LUA:
local pos = {x=1009, y=1020, z=6}
local reset, event = function(leverPos)
	doCreateItem(1285, 1, pos)
	doTransformItem(getTileItemById(leverPos, 1946).uid, 1945)
end, 0
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then -- the item uid
		doRemoveItem(getTileItemById(pos, 1285).uid)
		doTransformItem(item.uid, 1946)
		if getPlayerStorageValue(cid, 20009) < 2 then
			setPlayerStorageValue(cid, 20009, 2)
		end
		event = addEvent(reset, 5 * 60 * 1000, fromPosition)
	else
		stopEvent(event)
		reset(fromPosition)
	end
	return true
end
 
Back
Top