local items = {
{2112, 3954, 2520}, -- first 2 items are the first ones, the last one is the new one
{2666, 5896, 2671}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
local pos = {x = 100, y = 100, z = 7}
for i = 1, #items do
local x = items[i]
if getTileItemById(pos, x[1]).uid > 0 and getTileItemById(pos, x[2]).uid > 0 then
if doRemoveItem(getTileItemById(pos, x[1]).uid,1) and doRemoveItem(getTileItemById(pos, x[2]).uid,1) then
if item.itemid == 1945 then
doTransformItem(item.uid, 1946)
elseif item.itemid == 1946 then
doTransformItem(item.uid, 1945)
end
local first, second, third = getItemInfo(x[1]), getItemInfo(x[2]), getItemInfo(x[3])
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You changed "..first.article.." "..first.name.." and "..second.article.." "..second.name.." for "..third.article.." "..third.name..".")
doPlayerAddItem(cid, x[3], 1)
return true
end
end
end
doPlayerSendTextMessage(cid, 22, "You have to place the right items on the table.")
return true
end