function onUse(cid, item, fromPosition, itemEx, toPosition)
cfg = {
valid_time = 3 * 24 * 60 * 60,
storage = 18025,
min = 8,
experience = getPlayerLevel(cid) * 5000
}
if (exhaustion.check(cid, cfg.storage) == true) then
local time = exhaustion.get(cid, cfg.storage)
local hours, minutes, seconds = math.floor (time / 3600), math.floor ((time - ((math.floor (time / 3600)) * 3600))/ 60), time - ((math.floor (time/60)) * 60)
if time >= 3600 then
text = hours.." "..(hours > 1 and "hours" or "hour")..", "..minutes.." "..(minutes > 1 and "minutes" or "minute").." and "..seconds.." "..(seconds > 1 and "seconds" or "second")
elseif time >= 120 then
text = minutes.." "..(minutes > 1 and "minutes" or "minute").." and "..seconds.." "..(seconds > 1 and "seconds" or "second")
else
text = seconds.." "..(seconds > 1 and "seconds" or "second")
end
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You have to wait " .. text .. " before you can use another stone of wisdom.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return true
end
if (getPlayerLevel(cid) < cfg.min) then
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You have to be level " .. cfg.min .. " or higher to use this.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return true
end
exhaustion.set(cid, cfg.storage, cfg.valid_time)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_DEFAULT, "You gained " .. cfg.experience .. " experience points.")
doPlayerAddExp(cid, cfg.experience)
doRemoveItem(cid, item.uid, 1)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_SOUND_RED)
return true
end