function onUse(cid, item, fromPosition, itemEx, toPosition)
local action = xxxx -- put the Actionid of the chest
local vocation = getPlayerVocation(cid)
local smanaspent = XXXX --ammount of mana spent you want / this adds mlevel for sorcerer, druid
local pmanaspent = XXXX --ammount of mana spent you want / this adds mlevel for paladin
local slevel = doPlayerAddLevel(cid, amount)
local axe = 5 -- number of distance tries to add
local shield = 5 -- number of distance tries to add
local distance = 6 -- number of distance tries to add
local sorcerer = 1
local druid = 2
local paladin = 3
local knight = 4
local mastersorcerer = 5
local elderdruid = 6
local royalpaladin = 7
local eliteknight = 8
if item.actionid == action then
if getPlayerStorageValue(cid,action) == -1 then
if vocation == sorcerer or vocation == mastersorcerer or vocation == druid or vocation == elderdruid then
doPlayerAddSpentMana(cid, smanaspent)
doPlayerSendTextMessage(cid,25, "Here is your reward.")
setPlayerStorageValue(cid,action,1)
end
else
doPlayerSendCancel(cid,"You already got your reward!")
end
elseif item.actionid == action then
if getPlayerStorageValue(cid,action) == -1 then
if vocation == paladin or vocation == royalpaladin then
doPlayerAddSkillTry(cid, skillid, distance)
doPlayerAddSpentMana(cid, pmanaspent)
doPlayerSendTextMessage(cid,25, "Here is your reward.")
setPlayerStorageValue(cid,action,1)
end
else
doPlayerSendCancel(cid,"You already got your reward!")
end
elseif item.actionid == action then
if getPlayerStorageValue(cid,action) == -1 then
if vocation == knight or vocation == eliteknight then
doPlayerAddSkillTry(cid, skillid, axe)
doPlayerAddSkillTry(cid, skillid, shield)
doPlayerSendTextMessage(cid,25, "Here is your reward.")
setPlayerStorageValue(cid,action,1)
end
else
doPlayerSendCancel(cid,"You already got your reward!")
end
end
end