function onUse(cid, item, frompos, item2, topos)
local t = {
exp = 'single', -- single/random - single amount (eg 1000 experience) random amount (between x and x experience)
stor = 1337 -- Storage to store quest
}
local r = { -- if using random setup this
min = 1000,
max = 2000,
rdm = math.random(min, max)
}
local s = { -- if using single amount setup this
exp = 1000
}
if getPlayerStorageValue(cid, t.stor) == -1 then
if #t.exp == 'single' then
doPlayerAddExperience(cid, s.exp)
doPlayerSendTextMessage(cid, "You have gained ".. s.exp .." experience!")
setPlayerStorageValue(cid, t.stor)
elseif #t.exp == 'random' then
doPlayerAddExperience(cid, r.rdm)
doPlayerSendTextMessage(cid, "You have gained ".. r.rdm .." experience!")
setPlayerStorageValue(cid, t.stor)
else
doPlayerSendCancel(cid, "You have already used this chest.")
end
return true
end
end