Ir para conteúdo
  • 0

[Resolvido] [Suporte] Script bugado


LeoTK

Pergunta

Fala guys achei esse script no fórum de limitar as skills porém ao atingir o limite e relogar o player pode upar mais uma skill ao relogar outra skill até bugar ou ao infinito alguém pode me ajudar a solucionar esse bug? de quando o player relogar não poder passar do limite da skill estipulado no script?

 

Script

local skills = {	[SKILL_FIST] = {maxLevel = 249},    [SKILL_SWORD] = {maxLevel = 249},    [SKILL_AXE] = {maxLevel = 249},    [SKILL_CLUB] = {maxLevel = 249},    [SKILL_DISTANCE] = {maxLevel = 249},    [SKILL_SHIELD] = {maxLevel = 249},    [SKILL_FISHING] = {maxLevel = 249},    [SKILL__MAGLEVEL] = {maxLevel = 150},}function onAdvance(cid, skill, oldLevel, newLevel)    local i = skills[skill]        if i then        if newLevel > i.maxLevel then                        doPlayerSetRate(cid, skill, 0.0)            return false        end    end    return trueend

 

Link para o comentário
Compartilhar em outros sites

Posts Recomendados

  • 0
Agora, Nogard disse:

Nesse caso só vai funcionar ao avançar ao limite exato, não acima. O cara vai chegar no limite e ficar por ali.

um maninho me passou um aqui nogard que resolveu vou postar pra você ver

 

local skills = {
    [SKILL_FIST] = {maxLevel = 249},
    [SKILL_SWORD] = {maxLevel = 249},
    [SKILL_AXE] = {maxLevel = 249},
    [SKILL_CLUB] = {maxLevel = 249},
    [SKILL_DISTANCE] = {maxLevel = 249},
    [SKILL_SHIELD] = {maxLevel = 249},
    [SKILL_FISHING] = {maxLevel = 249},
    [SKILL__MAGLEVEL] = {maxLevel = 150},
}
function onAdvance(cid, skill, oldLevel, newLevel)
    local i = skills[skill]
    
    if i then
        if newLevel > i.maxLevel then
            
            doPlayerSetRate(cid, skill, 0.0)
            doPlayerSave(cid)
			doPlayerSetStorageValue(cid, skill+10000, 1)
            return false
        end
    end
    return true
end

 

e um segundo com

 

function onLogin(cid)
    
    
    
        if getPlayerStorageValue(cid, 0+10000) == 1 then
            doPlayerSetRate(cid, 0, 0.0)
                                end
                                if getPlayerStorageValue(cid, 1+10000) == 1 then
            doPlayerSetRate(cid, 1, 0.0)
                                end
                                if getPlayerStorageValue(cid, 2+10000) == 1 then
            doPlayerSetRate(cid, 2, 0.0)
                                end
                                if getPlayerStorageValue(cid, 3+10000) == 1 then
            doPlayerSetRate(cid, 3, 0.0)
                                end
                                if getPlayerStorageValue(cid, 4+10000) == 1 then
            doPlayerSetRate(cid, 4, 0.0)
                                end
                                if getPlayerStorageValue(cid, 5+10000) == 1 then
            doPlayerSetRate(cid, 5, 0.0)
                                end
                                if getPlayerStorageValue(cid, 6+10000) == 1 then
            doPlayerSetRate(cid, 6, 0.0)
                                end
                                if getPlayerStorageValue(cid, 7+10000) == 1 then
            doPlayerSetRate(cid, 7, 0.0)
                                end
                                return true
                                end

 

@Nogard

o primeiro com onadvance e o segundo com onlogin

Link para o comentário
Compartilhar em outros sites

  • 0
Agora, Nogard disse:

faz o mesmo processo no onLogin.

nosgard vou testar mas se eu te dizer que testei em tudo menos usando onlogin kkkkk vou testar já edito

ta faltando a função login no script

 

[Warning - Event::loadScript] Event onLogin not found (data/creaturescripts/scripts/skillblock.lua)

 

 

@Nogard

Link para o comentário
Compartilhar em outros sites

  • 0
local skills = {	[sKILL_FIST] = {maxLevel = 249},    [sKILL_SWORD] = {maxLevel = 249},    [sKILL_AXE] = {maxLevel = 249},    [sKILL_CLUB] = {maxLevel = 249},    [sKILL_DISTANCE] = {maxLevel = 249},    [sKILL_SHIELD] = {maxLevel = 249},    [sKILL_FISHING] = {maxLevel = 249},    [sKILL__MAGLEVEL] = {maxLevel = 150},}function onAdvance(cid, skill, oldLevel, newLevel)    local i = skills[skill]        if i then        if newLevel > i.maxLevel then                        doPlayerSetRate(cid, skill, 0.0)            doPlayerSave(cid)            return false        end    end    return trueend

 

 

tenta dar um save, mais fácil

Link para o comentário
Compartilhar em outros sites

  • 0
Agora, Nogard disse:

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

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

 

 

tenta dar um save, mais fácil

não deu certo continua upando ao relogar

@Nogard

não tem como colocar  o onLogin(cid)

na script junto com o advance?

Link para o comentário
Compartilhar em outros sites

  • 0
1 hora atrás, Nogard disse:

Quanto menos gambiarra melhor pra você, mano. Chegando em casa eu vejo isso pra ti.

blz vlw ^^

Link para o comentário
Compartilhar em outros sites

  • 0

Quando o cara reloga é adicionado + 1 level na skill? É isso? Porque deveria ser indiferente o ato de relogar, isso seria executado sempre que tentasse avançar, mesmo que a rate não estivesse em 0.

Link para o comentário
Compartilhar em outros sites

  • 0
Agora, Nogard disse:

Quando o cara reloga é adicionado + 1 level na skill? É isso? Porque deveria ser indiferente o ato de relogar, isso seria executado sempre que tentasse avançar, mesmo que a rate não estivesse em 0.

ao relogar o player pode treinar mais uma skill ai bloqueia novamente ai o player reloga e treina mais uma skill ai bloqueia a skill maxima denovo o player reloga e fica nisso em um clico infinito

Editado por Brunds
Link para o comentário
Compartilhar em outros sites

  • 0

tenta dessa forma:

 

local skills = {	[SKILL_FIST] = {maxLevel = 249},    [SKILL_SWORD] = {maxLevel = 249},    [SKILL_AXE] = {maxLevel = 249},    [SKILL_CLUB] = {maxLevel = 249},    [SKILL_DISTANCE] = {maxLevel = 249},    [SKILL_SHIELD] = {maxLevel = 249},    [SKILL_FISHING] = {maxLevel = 249},    [SKILL__MAGLEVEL] = {maxLevel = 150},}function onAdvance(cid, skill, oldLevel, newLevel)    local i = skills[skill]        if i then        if newLevel == i.maxLevel then                        doPlayerSetSkillRate(cid, skill, 0.0)            doPlayerSave(cid)            return true        end    end    return trueend

 

Link para o comentário
Compartilhar em outros sites

  • 0
Agora, Nogard disse:

É, funciona, mas fica extenso em... Resolvido então!

e mas parece que funcionou direitinho kkk mas agraço muito pela sua ajuda também xD

 

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...