Ir para conteúdo

Featured Replies

Postado

Olá pessoal, tenho um script de limite de skills porem ele não limita a magic level alguém pode ajudar?

function onAdvance(cid, skill, oldLevel, newLevel)
    if skill == SKILL_SWORD then
        if getPlayerSkillLevel(cid, SKILL_SWORD) >= 171 then
                doPlayerSetRate(cid, SKILL_SWORD, 0.0)
        end
    
    elseif skill == SKILL_SWORD then
        if getPlayerSkillLevel(cid, SKILL_FIST) >= 171 then
                doPlayerSetRate(cid, SKILL_FIST, 0.0)
        end    
    return false
    
    elseif skill == SKILL_AXE then
        if getPlayerSkillLevel(cid, SKILL_AXE) >= 171 then
                doPlayerSetRate(cid, SKILL_AXE, 0.0)
        end    
    return false
    
    elseif skill == SKILL_CLUB then
        if getPlayerSkillLevel(cid, SKILL_CLUB) >= 171 then
                doPlayerSetRate(cid, SKILL_CLUB, 0.0)
        end    
    return false
    
    elseif skill == SKILL_DISTANCE then
        if getPlayerSkillLevel(cid, SKILL_DISTANCE) >= 171 then
                doPlayerSetRate(cid, SKILL_DISTANCE, 0.0)
        end    
    return false
    
    elseif skill == SKILL_SHIELD then
        if getPlayerSkillLevel(cid, SKILL_FIST) >= 171 then
                doPlayerSetRate(cid, SKILL_FIST, 0.0)
        end    
    return false
    
    elseif skill == SKILL_FISH then
        if getPlayerSkillLevel(cid, SKILL_FISH) >= 171 then
                doPlayerSetRate(cid, SKILL_FISH, 0.0)
        end    
    return false
    
end
end

Resolvido por Orochi Elf

Ir para solução
  • Respostas 9
  • Visualizações 1.3k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Não testei.   local skills = {     [SKILL_SWORD] = {maxLevel = 171},     [SKILL_AXE] = {maxLevel = 171},     [SKILL_CLUB] = {maxLevel = 171},     [SKILL_DISTANCE] = {maxLevel = 171},     [SKILL_SH

  • Bom.. é porque no caso a variavel "SKILL_FISH", não existe, agora que eu fui ver, eu fui me baseando no seu script.   local skills = {     [SKILL_SWORD] = {maxLevel = 171},     [SKILL_AXE] = {maxL

  • Então o "return false", não está impedindo de avançar o level. Bom.. eu não sei se existe uma função, de setar a nova "rate" de magic level. então eu tou usando desta forma. teste ai.   local ski

Postado

Não testei.

 

local skills = {
    [SKILL_SWORD] = {maxLevel = 171},
    [SKILL_AXE] = {maxLevel = 171},
    [SKILL_CLUB] = {maxLevel = 171},
    [SKILL_DISTANCE] = {maxLevel = 171},
    [SKILL_SHIELD] = {maxLevel = 171},
    [SKILL_FISH] = {maxLevel = 171},
    [SKILL__MAGLEVEL] = {maxLevel = 171},
}

function onAdvance(cid, skill, oldLevel, newLevel)
    local i = skills[skill]
    
    if i then
        if newLevel >= i.maxLevel then
            return false
        end
    end
    return true
end

Tony Araújo  ;D 

 

Postado
  • Autor
  Em 14/12/2014 em 11:00, Orochi Elf disse:

 

Não testei.

local skills = {
    [SKILL_SWORD] = {maxLevel = 171},
    [SKILL_AXE] = {maxLevel = 171},
    [SKILL_CLUB] = {maxLevel = 171},
    [SKILL_DISTANCE] = {maxLevel = 171},
    [SKILL_SHIELD] = {maxLevel = 171},
    [SKILL_FISH] = {maxLevel = 171},
    [SKILL__MAGLEVEL] = {maxLevel = 171},
}

function onAdvance(cid, skill, oldLevel, newLevel)
    local i = skills[skill]
    
    if i then
        if newLevel >= i.maxLevel then
            return false
        end
    end
    return true
end

Valeu lek, vou testar.

Deu error..

 

[10:5:12.996] [Error - Test Interface] 
[10:5:12.996] data/creaturescripts/scripts/skillblock.lua
[10:5:12.996] Description: 
[10:5:12.996] data/creaturescripts/scripts/skillblock.lua:7: table index is nil[10:5:12.996] [Error - Event::checkScript] Cannot load script (data/creaturescripts/scripts/skillblock.lua)
Postado

Bom.. é porque no caso a variavel "SKILL_FISH", não existe, agora que eu fui ver, eu fui me baseando no seu script.

 

local skills = {
    [SKILL_SWORD] = {maxLevel = 171},
    [SKILL_AXE] = {maxLevel = 171},
    [SKILL_CLUB] = {maxLevel = 171},
    [SKILL_DISTANCE] = {maxLevel = 171},
    [SKILL_SHIELD] = {maxLevel = 171},
    [SKILL_FISHING] = {maxLevel = 171},
    [SKILL__MAGLEVEL] = {maxLevel = 171},
}

function onAdvance(cid, skill, oldLevel, newLevel)
    local i = skills[skill]
    
    if i then
        if newLevel >= i.maxLevel then
            return false
        end
    end
    return true
end

Tony Araújo  ;D 

 

Postado
  • Autor
  Em 14/12/2014 em 12:19, Orochi Elf disse:

 

Bom.. é porque no caso a variavel "SKILL_FISH", não existe, agora que eu fui ver, eu fui me baseando no seu script.

local skills = {
    [SKILL_SWORD] = {maxLevel = 171},
    [SKILL_AXE] = {maxLevel = 171},
    [SKILL_CLUB] = {maxLevel = 171},
    [SKILL_DISTANCE] = {maxLevel = 171},
    [SKILL_SHIELD] = {maxLevel = 171},
    [SKILL_FISHING] = {maxLevel = 171},
    [SKILL__MAGLEVEL] = {maxLevel = 171},
}

function onAdvance(cid, skill, oldLevel, newLevel)
    local i = skills[skill]
    
    if i then
        if newLevel >= i.maxLevel then
            return false
        end
    end
    return true
end

Não deu erro mas também não limitou

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.6k

Informação Importante

Confirmação de Termo