local config = {
spell = 'Name', -- name of the spell
vocations = {1, 2, 5, 6},
level = 100
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerLearnedInstantSpell(cid, config.spell) then
return doPlayerSendCancel(cid, "You have already learned the spell "..config.spell..".")
end
if not isInArray(config.vocations, getPlayerVocation(cid)) then
return doPlayerSendCancel(cid, "This spell is not for your vocation.")
end
if getPlayerLevel(cid) >= config.level then
doPlayerLearnInstantSpell(cid, config.spell)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have learned the spell "..config.spell..".")
else
doPlayerSendCancel(cid, "You need to be level "..config.level.." to learn this spell.")
end
return true
end