function onUse(cid, item, frompos, item2, topos)
-- check quest state
if getPlayerStorageValue(cid, 50002) == 1 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "It is empty.")
return true
end
-- attempt to give reward
local item = doCreateItemEx(2485, 1)
if doPlayerAddItemEx(cid, item, false) == RETURNVALUE_NOERROR then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have found a doublet.")
setPlayerStorageValue(cid, 50002, 1)
return true
end
-- tell player why reward was not given
if getPlayerFreeCap(cid) < 25 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "You have found a reward weighing 25.00 oz. It is too heavy.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_SMALL, "You have found a reward weighing 25.00 oz. You have no inventory space to receive it.")
end
doSendMagicEffect(getCreaturePosition(cid), CONST_ME_POFF)
return true
end