Untitled

 avatar
unknown
plain_text
10 months ago
1.5 kB
3
Indexable
local itemID = 12612 -- El ID del ítem que, al ser usado, otorgará la cantidad de niveles deseada
local levelGain = 100 -- La cantidad de niveles que se otorgarán
local mensagem = "¡Niveles Gratis!" -- El mensaje que aparecerá al usar el ítem
--- Configuraciones Principales:
local vocs = {1, 5, 2, 6, 3, 7, 4, 8} -- Vocaciones permitidas (1: Sorcerer, 5: Master Sorcerer, 2: Druid, 6: Elder Druid, 3: Knight, 7: Elite Knight, 4: Paladin, 8: Royal Paladin)
local voca = "Sorcerer, Master Sorcerer, Druid, Elder Druid, Knight, Elite Knight, Paladin, Royal Paladin" -- Nombres de las vocaciones permitidas
local level = 8 -- Nivel necesario para poder usar el ítem

function onUse(cid, item, frompos, item2, topos)
    local playerpos = getPlayerPosition(cid)
    if item.itemid == itemID and isInArray(vocs, getPlayerVocation(cid)) and getPlayerLevel(cid) >= level then
        for i = 1, levelGain do
            doPlayerAddLevel(cid, 1)
        end
        doSendMagicEffect(playerpos, 30)
        doCreatureSay(cid, mensagem, TALKTYPE_MONSTER_SAY, false, 0, playerpos)
        if isItem(item.uid) then
            doRemoveItem(item.uid)
        else
            doRemoveItem(item.uid, 1)
        end
        doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, "Has ganado " .. levelGain .. " niveles.")
    else
        doPlayerSendCancel(cid, "Lo siento, solo los " .. voca .. " de nivel " .. level .. "+ pueden usar este ítem.")
    end
    return true
end
Editor is loading...
Leave a Comment