function onUse(cid, item, frompos, item2, topos)
object = {x=0, y=0, z=7, stackpos=255}
getobject = getThingfromPos(objectpos)
if item.uid == UNIQUEID and item.itemid == 1945 then
doTransformItem(item.uid,item.itemid+1)
doRemoveItem(getobject.uid,1)
elseif item.uid == UNIQUEID and item.itemid == 1945 then
doCreateItem(OBJECTID,1,objectpos)
doTransformItem(item.uid,item.itemid-1)
else
doPlayerSendTextMessage(cid,22,"Sorry, not possible.")
end
return 1
end
local config = {
position = { x = 100, y = 100, z = 7 },
itemid = 2400
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 1945 then
doRemoveItem(getTileItemById(config.position, config.itemid).uid)
elseif item.itemid == 1946 then
doCreateItem(config.itemid, 1, config.position)
end
doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
return TRUE
end
local config = {
position = { x = 100, y = 100, z = 7 }, //position of the stone that's suppose to disappear or the lever?
itemid = 2400 //the stones item ID?
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 1945 then
doRemoveItem(getTileItemById(config.position, config.itemid).uid)
elseif item.itemid == 1946 then
doCreateItem(config.itemid, 1, config.position)
end
doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
return TRUE
end
<action script="openStoneThing.lua"/>
local config = {
position = { x = 1053, y = 984, z = 8 },
itemid = 1304
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 1945 then
doRemoveItem(getTileItemById(config.position, config.itemid).uid)
elseif item.itemid == 1946 then
doCreateItem(config.itemid, 1, config.position)
end
doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
return TRUE
end
You didn't assign it to an itemid/uniqueid/actionidCode:<action script="openStoneThing.lua"/>
local config, event = {
position = { x = 1053, y = 984, z = 8 },
itemid = 1304
}, 0
local function reset(leverPos)
doCreateItem(config.itemid, 1, config.position)
doTransformItem(getTileItemById(leverPos, 1946).uid, 1945)
end
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.itemid == 1945 then
doRemoveItem(getTileItemById(config.position, config.itemid).uid)
doTransformItem(item.uid, 1946)
event = addEvent(reset, 10 * 1000, toPosition)
elseif item.itemid == 1946 then
stopEvent(event)
reset(toPosition)
end
return TRUE
end