local setup = {
promotion = 2, --promotion level
items = 9969, --required item
count = 10, --require # of items
health = 15000, --new health that will be added(relative)
mana = 15000, --new mana that will be added(relative)
level = 30000,--required level
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerLevel(cid) < level then
doPlayerSendCancel(cid, 'You can not use this item at your current level.')
return true
end
if getPlayerPromotionLevel(cid) >= setup.promotion then
doPlayerSendCancel(cid, 'You are already promoted.')
return true
end
if doPlayerRemoveItem(cid, setup.items, setup.count) then
doRemoveItem(item.uid, 1)
doPlayerSetPromotionLevel(cid, setup.promotion)
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+setup.health)
setCreatureMaxMana(cid, getCreatureMaxMana(cid)+setup.mana)
doSendMagicEffect(fromPosition, CONST_ME_FIREWORK_YELLOW)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, 'You have been promoted to '..getPlayerVocationName(cid)..'!!')
doPlayerSave(cid)
else
doPlayerSendCancel(cid, 'You don\'t have all the required items.')
return true
end
return true
end