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

Solved Storage script

Cloow

Active Member
Joined
May 10, 2010
Messages
1,086
Reaction score
35
I don't get it, why wont these scripts work?


Lua:
function onUse(cid, item, frompos, item2, topos)
	if item.uid == 6124 then 
     setPlayerStorageValue(cid, 5184, 1)
	 doSendMagicEffect(cid,12)
	 doPlayerSendTextMessage(cid,22,'You found some strange power.')
	 end
		else
	if getPlayerStorageValue(cid, 5184) < 0 then
	doPlayerSendCancel(cid, "You already found the power.")
return true
end

Lua:
function onUse(cid, item, frompos, item2, topos)
	doPlayerAddItem(cid, 12339)
	doPlayerSendTextMessage(cid, "You found a ab1!")
	setPlayerStorageValue(cid, 51212, 1)
	end
	if getPlayerStorageValue(cid, 51212) < 0 then
	doPlayerSendCancel(cid, "There is nothing there")
	return true
 end

[20/01/2013 16:05:52] [Error - Action Interface]
[20/01/2013 16:05:52] data/actions/scripts/ab1.lua
[20/01/2013 16:05:52] Description:
[20/01/2013 16:05:52] (luaGetCreatureStorage) Creature not found

[20/01/2013 16:05:53] [Error - Action Interface]
[20/01/2013 16:05:53] data/actions/scripts/ab1.lua
[20/01/2013 16:05:53] Description:
[20/01/2013 16:05:53] data/actions/scripts/ab1.lua:6: attempt to compare boolean with number
[20/01/2013 16:05:53] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/ab1.lua)
[20/01/2013 16:05:53] data/actions/scripts/accestoquestdoorms.lua:8: 'then' expected near 'doPlayerSendCancel'
[20/01/2013 16:05:53] [Error - LuaScriptInterface::loadFile] data/actions/scripts/accestoquestdoorms.lua:7: 'end' expected (to close 'function' at line 1) near 'else'
[20/01/2013 16:05:53] [Warning - Event::loadScript] Cannot load script (data/actions/scripts/accestoquestdoorms.lua)
[20/01/2013 16:05:53] data/actions/scripts/accestoquestdoorms.lua:7: 'end' expected (to close 'function' at line 1) near 'else'

thanks in advance
 
[20/01/2013 21:32:35] [Error - Action Interface]
[20/01/2013 21:32:35] data/actions/scripts/stlever1.lua:eek:nUse
[20/01/2013 21:32:35] Description:
[20/01/2013 21:32:35] (luaGetThingFromPos) Tile not found

[20/01/2013 21:32:35] [Error - Action Interface]
[20/01/2013 21:32:35] data/actions/scripts/stlever1.lua:eek:nUse
[20/01/2013 21:32:35] Description:
[20/01/2013 21:32:35] (luaDoRemoveItem) Item not found

It reads ( doCreatureSay(cid, 'Something has been moved for '..Cyko.Timer..' seconds, please explore', TALKTYPE_MONSTER) ) everything goes smoothly.
But the stone is still in it place


Lua:
local Cyko = {
	LeverPos = {x=2506, y=2499, z=7, stackpos=1}, --Posistion of the lever, so players can use it again
	ItemPos = {x=2490, y==2478, z=7, stackpos=1}, -- Posistion of the item which will be removed and also created
	Timer = 60, --How long should the item be removed
	ItemId = 1354 --ID of the removed item
}
 
function onUse(cid, item, fromPos, item2, toPos)
    if item.itemid == 1945 then
        doRemoveItem(getThingfromPos(Cyko.ItemPos).uid, 1)
        doTransformItem(item.uid, 1946)
        addEvent(onBack, Cyko.Timer*1000)
        doCreatureSay(cid, 'Something has been moved for '..Cyko.Timer..' seconds, please explore', TALKTYPE_MONSTER)
    else
        doPlayerSendCancel(cid, "Sorry, but someone already used this switch.")
    end
return true
end
 
function onBack()
    doTransformItem(getThingFromPos(Cyko.LeverPos).uid, 1945)
    doCreateItem(Cyko.ItemId,1,Cyko.ItemPos)
end

also this
7ZU7gG.png
 
How is that even possible, it didnt happend on me.

Also make sure put the lever on a counter so none steps into it.
 
Yeah the counter fixed the copy problem.
Still getting the errors tough :s could it be because of the distro?

[20/01/2013 21:43:52] > Current version information - version: 1.0, patch: 1, build: 3429, timestamp: 1261647210.
[20/01/2013 21:43:52] > Latest version information - version: 0.3.6, patch: 0, build: 3293, timestamp: 1260652199.


-- Edit --

6_QKx5.png

heppens after 60 seconds
 
Ok i remade Cykotitan script, it should work now.
Lua:
        local pos, e = {x=999, y=1010, z=7}, 0 --Pos of the item
	local itemid = 1285 --ID of the item getting removed
	local timer = 5 --When will the item come back
	
	local f = function(p)
	doCreateItem(itemid, 1, pos)
	doTransformItem(getTileItemById(p, 1946).uid, 1945)
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		doRemoveItem(getTileItemById(pos, itemid).uid)
		e = addEvent(f, timer * 1000, fromPosition)
		doTransformItem(item.uid, 1946)
		doCreatureSay(cid, 'Something has been moved for '..timer..' seconds, please explore', TALKTYPE_MONSTER)
	else
	    doPlayerSendCancel(cid, "Someone has already used this lever.")
	end
	return true
end
 
Last edited:
[20/01/2013 21:56:48] [Error - Action Interface]
[20/01/2013 21:56:48] data/actions/scripts/stlever1.lua:eek:nUse
[20/01/2013 21:56:48] Description:
[20/01/2013 21:56:48] (luaDoRemoveItem) Item not found

:O
There must be some other function than "doRemoveItem" than can be used in it place?
 
Retry

- - - Updated - - -

Also make sure you write right itemid which getting removed and pos of that item.
 
SKHgJU.png

2QpCpD.png


if I pull again
iakhQp.png



Console:
[20/01/2013 22:03:40] [Error - Action Interface]
[20/01/2013 22:03:40] data/actions/scripts/stlever1.lua:eek:nUse
[20/01/2013 22:03:40] Description:
[20/01/2013 22:03:40] (luaDoRemoveItem) Item not found

Did only send me the error once, I pulled the lever atleast 10 times


-- Edit --
Lua:
<action uniqueid="6551" script="stlever1.lua" />
Lua:
 local pos, e = {x=2506, y=2499, z=7}, 1304 --Pos of the item
	local itemid = 1304 --ID of the item getting removed
	local timer = 60 --When will the item come back
 
	local f = function(p)
	doCreateItem(itemid, 1, pos)
	doTransformItem(getTileItemById(p, 1946).uid, 1945)
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.itemid == 1945 then
		doRemoveItem(getTileItemById(pos, itemid).uid)
		e = addEvent(f, timer * 1000, fromPosition)
		doTransformItem(item.uid, 1946)
		doCreatureSay(cid, 'Something has been moved for '..timer..' seconds, please explore', TALKTYPE_MONSTER)
	else
	    doPlayerSendCancel(cid, "Someone has already used this switch.")
		stopEvent(e)
		e = 0
		f(fromPosition)
	end
	return true
end

g-ZP2N.png

pBzlM6.png
 
Last edited:
Why is the stone created underneath the lever? You dont need put pos for the lever only for the stone.
 
Oh, haha..
I mixed the pos there :eek:

Lua:
 local pos, e = {x=2506, y=2499, z=7}, 1304 --Pos of the item

everything works now! Thanks alot for all the help cyko! Im forever grateful :3
 
Back
Top