• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Convert onAdvance spell notification script to TFS 1.3

jel

Member
Joined
Mar 22, 2014
Messages
302
Reaction score
12
good morning, someone could convert this script to tfs 1.3. thanks

Lua:
function onAdvance(cid, skill, oldLevel, newLevel)
    if skill == SKILL__LEVEL then       
        local spells = {}
        for index = 0,  getPlayerInstantSpellCount(cid) - 1 do
            local spell = getPlayerInstantSpellInfo(cid, index)
        
            if spell.level > oldLevel and spell.level <= newLevel then
                table.insert(spells, "   [".. spell.name .."] \"".. spell.words .. "\" Mana[".. spell.mana .."]")
            end
        end
    
        if #spells > 0 then         
            doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, "You have just advanced to level ".. newLevel .." and learned new spells!")

            for _, v in pairs(spells) do
                doPlayerSendTextMessage(cid, MESSAGE_EVENT_ORANGE, v)
            end
        end
    end
        
    return true
end
 
Solution
Lua:
function onAdvance(player, skill, oldLevel, newLevel)
    if skill == SKILL_LEVEL then
        local spells = {}
        for _, spell in ipairs(player:getInstantSpells()) do
            
            if spell.level > oldLevel and spell.level <= newLevel then
                table.insert(spells, "   [".. spell.name .."] \"".. spell.words .. "\" Mana[".. spell.mana .."]")
            end
        end

        if #spells > 0 then 
            player:sendTextMessage(MESSAGE_EVENT_ORANGE, "You have just advanced to level ".. newLevel .." and learned new spells!")
            
            for _, spellInfo in pairs(spells) do
                player:sendTextMessage(MESSAGE_EVENT_ORANGE, spellInfo)
            end
        end
    end...
Lua:
function onAdvance(player, skill, oldLevel, newLevel)
    if skill == SKILL_LEVEL then
        local spells = {}
        for _, spell in ipairs(player:getInstantSpells()) do
            
            if spell.level > oldLevel and spell.level <= newLevel then
                table.insert(spells, "   [".. spell.name .."] \"".. spell.words .. "\" Mana[".. spell.mana .."]")
            end
        end

        if #spells > 0 then 
            player:sendTextMessage(MESSAGE_EVENT_ORANGE, "You have just advanced to level ".. newLevel .." and learned new spells!")
            
            for _, spellInfo in pairs(spells) do
                player:sendTextMessage(MESSAGE_EVENT_ORANGE, spellInfo)
            end
        end
    end
    
    return true
end
 
Solution
Back
Top