local t = {
[10000] = {100, 2160, 10},
[10001] = {150, 2160, 20},
[10002] = {200, 2160, 30}
}
local storage = 84848
function onUse(cid, item, fromPosition, itemEx, toPosition)
local v = t[item.actionid]
if (getPlayerLevel(cid) < v[1]) then
return doPlayerSendCancel(cid, "You must be at least level "..v[1].."."), doSendMagicEffect(getThingPos(cid), CONST_ME_POFF), false
end
if (getPlayerStorageValue(cid, storage + v[1]) > 0) then
return doPlayerSendCancel(cid, "You have already taken your reward."), doSendMagicEffect(getThingPos(cid), CONST_ME_POFF), false
end
doPlayerAddItem(cid, v[2], v[3])
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "You have been rewarded with " .. v[3] .. " " .. getItemDescriptionsById(v[2]).plural .. "!")
setPlayerStorageValue(cid, storage + v[1], 1)
return true
end