local charges = {[2161] = 200, [2164] = 20, [2170] = 200, [2172] = 200, [2197] = 5, [2198] = 50, [2199] = 150, [2200] = 250, [2201] = 200, [7887] = 200, [7888] = 200, [7889] = 200, [7890] = 200, [10218] = 5, [10219] = 5, [10220] = 5, [10221] = 5}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if item.uid > 0 and item.uid <= 65535 then
if getPlayerStorageValue(cid, item.uid) <= 0 then
local getArticle = getItemDescriptions(item.actionid).article
local article = getArticle ~= "" and getArticle
if getPlayerFreeCap(cid) >= getItemWeight(item.actionid, 1) then
local itemToAdd = doCreateItemEx(item.actionid, charges[item.actionid] or 1)
if doPlayerAddItemEx(cid, itemToAdd, 0) == RETURNVALUE_NOERROR then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found " .. (article and article .. " " or "") .. getItemName(item.actionid) .. ".")
setPlayerStorageValue(cid, item.uid, 1)
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found " .. (article and article .. " " or "") .. getItemName(item.actionid) .. ", but you have no room to take it.")
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found " .. (article and article .. " " or "") .. getItemName(item.actionid) .. ". Weighing " .. getItemWeight(item.actionid, 1) .. " oz it is too heavy.")
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The " .. getItemName(item.itemid) .. " is empty.")
end
return TRUE
end
return FALSE
end