local t = {
remove = {2499, 1},
add = {2500, 1},
storage = 30045
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid, t.storage) < 1 then
local v = (t.add[2] > 1 and t.add[2] or getItemInfo(t.add[1]).article) .. " " .. (t.add[2] > 1 and getItemInfo(t.add[1]).plural or getItemInfo(t.add[1]).name)
if getPlayerItemCount(cid, t.remove[1]) >= t.remove[2] then
if getPlayerFreeCap(cid) >= getItemWeightById(t.add[1], t.add[2]) then
doPlayerRemoveItem(cid, t.remove[1], t.remove[2])
doPlayerAddItem(cid, t.add[1], t.add[2])
setPlayerStorageValue(cid, t.storage, 1)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found " .. v .. ".")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found " .. v .. ". Weighing " .. getItemWeightById(t.add[1], t.add[2]) .. " oz it is too heavy.")
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You do not have " .. (t.remove[2] > 1 and t.remove[2] or getItemInfo(t.remove[1]).article) .. " " .. (t.remove[2] > 1 and getItemInfo(t.remove[1]).plural or getItemInfo(t.remove[1]).name) .. ".")
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,"You have already done this.")
end
return true
end