That is one ugly script, fixed it for you and removed storage. Not sure if this quest is supposed to be for more than one player, if so then the script will need further adjustment. If it's just for one player then this should work fine:
function onUse(cid, item, frompos, item2, topos)
local...