Ir para conteúdo

Featured Replies

Postado
  • Solução
local config = {
    storage = 5820,
    levels = {
        [20] = {                                  --[level] = {
            [1] = {itemid, itemid, itemid, ...},  --[vocation_id] = {items},
        },
        [40] = {                                  --[level] = {
            [1] = {itemid, itemid, itemid, ...},  --[vocation_id] = {items},
        },
    },
}
function onAdvance(cid, skill, oldLevel, newLevel)
    local level
    for prizeLevel, prizes in pairs(config.levels) do
        if newLevel >= prizeLevel and getPlayerStorageValue(cid, config.storage + prizeLevel) < 1 then
            level = prizeLevel
            break
        end
    end
    if level then
        local set = config.levels[level][getPlayerVocation(cid)]
        if set then
            local parcel, str = doCreateItemEx(ITEM_PARCEL), ""
            for i = 1, #set do
                if str == "" then
                    str = "1x "..getItemNameById(set[i])
                else
                    str = str..(i == #set and " e " or ", ").."1x "..getItemNameById(set[i])
                end
                doAddContainerItem(parcel, set[i], 1)
            end
            doPlayerSendMailByName(getCreatureName(cid), parcel, 1)
            setPlayerStorageValue(cid, config.storage, 1)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Graças a sua determinação em atingir o level "..newLevel..", você foi premiado com "..str..". Um parcel foi enviado ao depot de sua cidade principal.")
        end
    end
    return true
end

Testei o código em meu servidor, e está funcionando perfeitamente.

Editado por zipter98 (veja o histórico de edições)

não respondo pms solicitando suporte em programação/scripting

  • Respostas 13
  • Visualizações 572
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Não se esqueça de registrar o evento em login.lua. data/creaturescripts/scripts: local config = {     storage = 5820,     levels = {         [20] = {                                  --[level] = {

  • Tá querendo "copiar" o RPG mesmo em kkkkkkkkkkk @topic  Você registrou em login.lua ? Como mencionou o Zipter98?

  • Você configurou a tabela corretamente? Está upando com a(s) vocação(ões) definida(s) em sets?

Postado
  • Autor
            [1,5] = {itemid, itemid, itemid, ...},  --[vocation_id] = {items},
            [2,6] = {itemid, itemid, itemid, ...},  --[vocation_id] = {items},
            [3,7] = {itemid, itemid, itemid, ...},  --[vocation_id] = {items},
            [4,8] = {itemid, itemid, itemid, ...},  --[vocation_id] = {items},
 
pra colocar as 2 vocações é assim?

[progress=green]50[/progress]

 

Postado

Não, apenas uma vocação por tabela.

Ex.:

    [1] = {itemid, itemid, itemid, ...},  --[vocation_id] = {items},
    [5] = {itemid, itemid, itemid, ...},  --[vocation_id] = {items},
    [2] = {itemid, itemid, itemid, ...},  --[vocation_id] = {items},
    [6] = {itemid, itemid, itemid, ...},  --[vocation_id] = {items},
    [3] = {itemid, itemid, itemid, ...},  --[vocation_id] = {items},
    [7] = {itemid, itemid, itemid, ...},  --[vocation_id] = {items},
    [4] = {itemid, itemid, itemid, ...},  --[vocation_id] = {items},
    [8] = {itemid, itemid, itemid, ...},  --[vocation_id] = {items},

Editado por zipter98 (veja o histórico de edições)

não respondo pms solicitando suporte em programação/scripting

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo