• 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 My Server Have 23206 Line of Spells Script Talkaction of Debug

Enderlop

Banned User
Joined
Jan 10, 2024
Messages
93
Reaction score
16
Lua:
function onSay(cid, words, param, channel)
    local maxSpellsToShow = 8000 -- Define o número máximo de feitiços a serem mostrados
    local t = {}
    
    -- Loop através dos feitiços do jogador
    for i = 0, getPlayerInstantSpellCount(cid) - 1 do
        if #t >= maxSpellsToShow then
            break -- Sai do loop se o limite máximo de feitiços for atingido
        end
        
        local spell = getPlayerInstantSpellInfo(cid, i)
        
        -- Verifica se o feitiço não está no nível mínimo
        if(spell.mlevel ~= 1) then
            table.insert(t, spell.words) -- Adiciona apenas o nome da magia à lista
        end
    end

    -- Ordena os feitiços em ordem alfabética
    table.sort(t)

    -- Constrói a mensagem a ser exibida
    local text = ""
    local prevLevel = -1
    for _, spellName in ipairs(t) do
        text = text .. spellName .. "\n"
    end

    -- Verifica o comprimento do texto
    if #text > 8000 then
        local chunks = {}
        local current_chunk = ""
        for _, spellName in ipairs(t) do
            if #current_chunk + #spellName > 8000 then
                table.insert(chunks, current_chunk)
                current_chunk = ""
            end
            current_chunk = current_chunk .. spellName .. "\n"
        end
        table.insert(chunks, current_chunk)

        for _, chunk in ipairs(chunks) do
            doShowTextDialog(cid, 2175, chunk)
        end
    else
        -- Mostra a mensagem ao jogador
        doShowTextDialog(cid, 2175, text)
    end

    return true
end
 
Back
Top