• 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!

TFS 0.X !spells with needlearn="1"

zabuzo

Well-Known Member
Joined
Jun 10, 2016
Messages
237
Reaction score
54
I have this spellup script that show all spells avaliable to buy to your magic level, when u get one more magic level:
Code:
--[[------------------------------------------------<|]
    |* * * * * * * * * * * * * * * * * * * * * * * * * * *|
    |* * * * * * *  [SpellUp! Script] * * * * * * * * * * |
    |* * * * * * * * By: Cybermaster * * * * * * * * * * *|     
    |* * *  Tested on: The Forgotten Server 0.3.6pl1 * * *|
    |* * * * * * * * * * * * * * * * * * * * * * * * * * *|
    |>---------------------------------------------------]]

local s = { --SETUP
    repeatAfterDeath = true, -- true -> player will always get the msg at lvlup | false -> player will only get the 1st time the gets the new level
-- storage below is where the newlevel will be stored ONLY IF YOU USE repeatAfterDeath
    Storage = 10000,
    messageType = 'popUp', -- options: 'popUp' or 'channel'
--this one below only used if messageType = channel
    channelClass = MESSAGE_EVENT_ORANGE
}
   
function onAdvance(cid, skill, oldlevel, newlevel)
    if skill ~= 7 or not s.repeatAfterDeath and getCreatureStorage(cid, s.Storage) >= newlevel then
        return true
    end
 
    local t = {}
    for i = 0, getPlayerInstantSpellCount(cid) - 1 do
        local spell = getPlayerInstantSpellInfo(cid, i)
        if(spell.mlevel ~= 0) and spell.mlevel == newlevel then
            if(spell.manapercent > 0) then
                spell.mana = spell.manapercent .. '%'
            end
            table.insert(t, spell)
        end
    end

    table.sort(t, function(a, b) return a.level < b.level end)
    local tmpStr = ''
    local Str = ''
    for i, spell in ipairs(t) do
        tmpStr = 'NEW SPELL:\n['..spell.name..'] "'..spell.words..'"\n\n'
        Str = Str .. tmpStr
    end
 
    if Str == '' then
        return true
    end
 
    doCreatureSetStorage(cid, s.Storage, newlevel)
    if s.messageType == 'popUp' then
        doShowTextDialog(cid, 2175, Str)
    elseif s.messageType == 'channel' then
        doPlayerSendTextMessage(cid, s.channelClass, Str)
    end
    return true
end

i tried to create a !spells based on that script /\
to show all spells your vocation could use:
Code:
function onSay(cid, words, param, channel)
    local t = {}
    for i = 0, getPlayerInstantSpellCount(cid) - 1 do
        local spell = getPlayerInstantSpellInfo(cid, i)
        if(spell.manapercent > 0) then
            spell.mana = spell.manapercent .. '%'
        end
        table.insert(t, spell)
    end

    table.sort(t, function(a, b) return a.level < b.level end)
    local tmpStr = ''
    local Str = ''
    for i, spell in ipairs(t) do
        tmpStr = '('..i..'):\n['..spell.name..'] "'..spell.words..'"\n\n'
        Str = Str .. tmpStr
    end

    doShowTextDialog(cid, 2175, Str)
    return true
end

but it is not showing not even one spell...
why?
 
Top