function doPlayerAddMagicLevel(cid, amount)
return doPlayerAddSpentMana(cid, getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + amount) - getPlayerSpentMana(cid))
end
local STORAGE = 20
function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerStorageValue(cid, STORAGE)>= 1 then
return true
end
local voc = getPlayerVocation(cid)
if voc == 1 or voc == 2 or voc == 5 or voc == 6 or voc == 15 or voc == 16 then
doPlayerAddMagicLevel(cid, 5)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Você abriu um baú e ganhou 15 de skill em magic level, parabéns.")
elseif voc == 3 or voc == 7 then
doPlayerAddSkill(cid, SKILL_DISTANCE, 15)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Você abriu um baú e ganhou 15 de skill em distance fighting, parabéns.")
elseif voc == 4 or voc == 8 then
local club = getPlayerSkillLevel(cid, 1)
local sword = getPlayerSkillLevel(cid,2)
local axe = getPlayerSkillLevel(cid, 3)
local skill_add = ""
if club > sword and club > axe then
doPlayerAddSkill(cid, 1, 15)
skill_add = "club"
elseif axe > club and axe > sword then
doPlayerAddSkill(cid, 2, 15)
skill_add = "axe"
else
doPlayerAddSkill(cid, 3, 15)
skill_add = "sword"
end
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Você abriu um baú e ganhou 15 de skill em ".. skill_add .. " fighting, parabéns.")
elseif voc == 13 or voc == 14 then
doPlayerAddSkill(cid, 1, 15)
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Você abriu um baú e ganhou 15 de skill em club, parabéns.")
end
setPlayerStorageValue(cid, STORAGE, 1)
return true
end
Não encontrei a função que adiciona magic level ao player, por isso pode ser que não funcione bem no seu servidor. Testa aí.