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

Help Adding to this script

gunmetal

New Member
Joined
Oct 15, 2007
Messages
75
Reaction score
0
I have this script:

PHP:
---------------------------- Start Config ----------------------------
local stonepos = {x=1551, y=528, z=15, stackpos=1} -- Stone pos
local STONEID = 1355 -- stone id
----------------------------- End Config -----------------------------
function onUse(cid, item, fromPos, item2, toPos)
		
		if item.actionid == 29001 and item.itemid == 1945 then
		doRemoveItem(getThingfromPos(stonepos).uid)
		doTransformItem(item.uid,1946)
else
		doCreateItem(STONEID, 1, stonepos)
		doTransformItem(item.uid, 1945)
end
return 1
end


I want to add a timer to the lever and have it reset the wall. How can i do that? rep to anyone who can help me out
 
Lua:
---------------------------- Start Config ---------------------------- 
local stonepos = {x=1551, y=528, z=15, stackpos=1} -- Stone pos 
local STONEID = 1355 -- stone id 
local time = 5 -- seconds
----------------------------- End Config ----------------------------- 
function onUse(cid, item, fromPos, item2, toPos) 
         
        if item.actionid == 29001 and item.itemid == 1945 then 
        doRemoveItem(getThingfromPos(stonepos).uid)
        doCreatureSay(cid, 'The stone will be removed for '..time..' sec', TALKTYPE_MONSTER)
        addEvent(doCreateItem, time * 1000, stoneId, 1, stonepos)		
        doTransformItem(item.uid,1946) 
else 
        doCreateItem(STONEID, 1, stonepos) 
        doTransformItem(item.uid, 1945) 
end 
return 1 
end
 
client crashed and i got this error in the console

PHP:
[25/02/2013 23:55:41] Lua Script Error: [Action Interface] 
[25/02/2013 23:55:41] in a timer event called from: 
[25/02/2013 23:55:41] data/actions/scripts/quests/dhwallremover.lua:onUse
[25/02/2013 23:55:41] LuaScriptInterface::luaDoCreateItem(). Item not found
[25/02/2013 23:55:41] stack traceback:
[25/02/2013 23:55:41] 	[C]: ?
 
Ok, use this script instead:

Lua:
local config = {
	stoneId = 1304,
	pos = {x=979, y=1458, z=4},
	time = 5, -- seconds
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 or 1946 then
		if getTileItemById(config.pos, config.stoneId).uid > 0 then
			doRemoveItem(getTileItemById(config.pos, config.stoneId).uid)
			doCreatureSay(cid, 'The stone will be removed for '..config.time..' sec', TALKTYPE_MONSTER)
			addEvent(doCreateItem, config.time * 1000, config.stoneId, 1, config.pos)

		else
			doPlayerSendCancel(cid, 'The stone is removed already.')
		end
	end
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end

Just change position etc
 
wierd this time it crashed but no error in the console

- - - Updated - - -

the script works without the time and text tho
 
Back
Top Bottom