• 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 skill stages depending on vocation

sucibob

Member
Joined
Mar 28, 2017
Messages
128
Reaction score
13
I found this script:
But there is a big problem on that, the rates not change by vocation
So knights for example always have a high magic level rate

I tried to fix but with no success, is anyone more with more experience could help me to put to work?

data\creaturescripts\scripts\ file stagesconfig.lua
Code:
-- Skill Stages Mages --
skillConfigM = {skill = getConfigValue('rateSkill'), magiclevel = getConfigValue('rateMagic')}
skillStagesM = {}
skillStagesM[SKILL_FIST] = {{0,0}}
skillStagesM[SKILL_CLUB] = {{0,0.5}}
skillStagesM[SKILL_SWORD] = {{0,0.5}}
skillStagesM[SKILL_AXE] = {{0,0.5}}
skillStagesM[SKILL_DISTANCE] = {{0,0.5}}
skillStagesM[SKILL_SHIELD] = {{0,3},{15,2},{25,1}}
--skillStagesM[SKILL_FISHING] = {{0,5},{60,4},{80,3},{100,2},{110,1}}
skillStagesM[SKILL__MAGLEVEL] = {{0,1.0},{20,2.0},{30,3.0},{40,1.5},{50,1},{60,0.5}}

-- Skill Stages Paladin --
skillConfigR = {skill = getConfigValue('rateSkill'), magiclevel = getConfigValue('rateMagic')}
skillStagesR = {}
skillStagesR[SKILL_FIST] = {{0,0}}
skillStagesR[SKILL_CLUB] = {{0,0.5}}
skillStagesR[SKILL_SWORD] = {{0,0.5}}
skillStagesR[SKILL_AXE] = {{0,0.5}}
skillStagesR[SKILL_DISTANCE] = {{0,3},{4,2},{9,1},{15,0.5}}
skillStagesR[SKILL_SHIELD] = {{0,3},{40,1},{60,0.5}}
--skillStagesR[SKILL_FISHING] = {{0,5},{60,4},{80,3},{100,2},{110,1}}
skillStagesR[SKILL__MAGLEVEL] = {{0,3},{4,2},{9,1},{15,0.5}}

-- Skill Stages Knight --
skillConfigW = {skill = getConfigValue('rateSkill'), magiclevel = getConfigValue('rateMagic')}
skillStagesW = {}
skillStagesW[SKILL_FIST] = {{0,0}}
skillStagesW[SKILL_CLUB] = {{0,3},{40,2},{60,1},{80,0.5}}
skillStagesW[SKILL_SWORD] = {{0,3},{40,2},{60,1},{80,0.5}}
skillStagesW[SKILL_AXE] = {{0,3},{40,2},{60,1},{80,0.5}}
skillStagesW[SKILL_DISTANCE] = {{0,0.5}}
skillStagesW[SKILL_SHIELD] = {{0,3},{40,2},{60,1},{80,0.5}}
--skillStagesW[SKILL_FISHING] = {{0,5},{60,4},{80,3},{100,2},{110,1}}
skillStagesW[SKILL__MAGLEVEL] = {{0,3},{4,2},{6,1},{9,0.5}}

-- Skill Stages Rooker (None) --
skillConfigN = {skill = getConfigValue('rateSkill'), magiclevel = getConfigValue('rateMagic')}
skillStagesN = {}
skillStagesN[SKILL_FIST] = {{0,0}}
skillStagesN[SKILL_CLUB] = {{0,5},{10,4},{15,3},{20,2},{25,1},{30,0.5}}
skillStagesN[SKILL_SWORD] = {{0,5},{10,4},{15,3},{20,2},{25,1},{30,0.5}}
skillStagesN[SKILL_AXE] = {{0,5},{10,4},{15,3},{20,2},{25,1},{30,0.5}}
skillStagesN[SKILL_DISTANCE] = {{0,5},{10,4},{15,3},{20,2},{25,1},{30,0.5}}
skillStagesN[SKILL_SHIELD] = {{0,5},{10,4},{15,3},{20,2},{25,1},{30,0.5}}
--skillStagesW[SKILL_FISHING] = {{0,5},{60,4},{80,3},{100,2},{110,1}}
skillStagesN[SKILL__MAGLEVEL] = {{0,0}}



showInfoOnAdvance = true -- send player message about skill rate change
showInfoOnLogin = true -- send player message about skill rates when he login

function getPlayerSkillRatesText(cid)
local skillInfo = getPlayerRates(cid)
return "YOUR RATES: [ Magic Level: " .. skillInfo[SKILL__MAGLEVEL] * skillConfig.magiclevel .. "x || Fist: " .. skillInfo[SKILL_FIST] * skillConfig.skill .. "x | Club: " .. skillInfo[SKILL_CLUB] * skillConfig.skill .. "x |  Sword: " .. skillInfo[SKILL_SWORD] * skillConfig.skill .. "x | Axe: " .. skillInfo[SKILL_AXE] * skillConfig.skill .. "x |  Distance: " .. skillInfo[SKILL_DISTANCE] * skillConfig.skill .. " | Shielding: " .. skillInfo[SKILL_SHIELD] * skillConfig.skill .. "x | Fishing: " .. skillInfo[SKILL_FISHING] * skillConfig.skill .. "x ]"
end


In data\creaturescripts\scripts\ file skillstagesadvance.lua:
Code:
dofile(getDataDir() .. "creaturescripts/scripts/stagesconfig.lua")

function isMage(cid)
    local voc = getPlayerVocation(cid)
    if voc == 1 or voc == 2 or voc == 5 or voc == 6 or voc == 9 or voc == 10 or voc == 13 or voc == 14 then
        return true
    else
        return false
    end
end

function isRanger(cid)
    local voc = getPlayerVocation(cid)
    if voc == 3 or voc == 7 or voc == 11 or voc == 15 then
        return true
    else
        return false
    end
end

function isWarrior(cid)
    local voc = getPlayerVocation(cid)
    if voc == 4 or voc == 8 or voc == 12 or voc == 6 or voc == 16 then
        return true
    else
        return false
    end
end

function isRooker(cid)
    local voc = getPlayerVocation(cid)
    if voc == 0 or voc == 17 or voc == 18 or voc == 19 or voc == 20 then
        return true
    else
        return false
    end
end

function onAdvance(cid, skill, oldLevel, newLevel)
    -- Mage --
    if isMage(cid) then
        if(skillStagesM[skill] ~= nil) then
        local skillRateM = 1
        local oldRatesM = getPlayerRates(cid)
        for i, skillRateInfoM in pairs(skillStagesM[skill]) do
            if(newLevel >= skillRateInfoM[1]) then
                skillRateM = skillRateInfoM[2]
            else
                break
            end
        end
        doPlayerSetRate(cid, skill, skillRateM)
        if(showInfoOnAdvance and skillRateM ~= oldRatesM[skill]) then
            if(skill >= 0 and skill <= 6) then
                configRateM = skillConfigM.skill
            else
                configRateM = skillConfigM.magiclevel
            end
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getPlayerNewSkillRatesText(cid))
        end
    -- Paladin --
    elseif isRanger(cid) then
        if(skillStagesR[skill] ~= nil) then
            local skillRateP = 1
            local oldRatesP = getPlayerRates(cid)
            for i, skillRateInfoP in pairs(skillStagesR[skill]) do
                if(newLevel >= skillRateInfoP[1]) then
                    skillRateP = skillRateInfoP[2]
                else
                    break
                end
            end
        end
        doPlayerSetRate(cid, skill, skillRateP)
        if(showInfoOnAdvance and skillRateP ~= oldRatesP[skill]) then
        if(skill >= 0 and skill <= 6) then
            configRateP = skillConfigR.skill
        else
            configRateP = skillConfigR.magiclevel
        end
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getPlayerNewSkillRatesText(cid))
    -- Knight --
    elseif isWarrior(cid) then
        if(skillStagesW[skill] ~= nil) then
            local skillRateW = 1
            local oldRatesK = getPlayerRates(cid)
            for i, skillRateInfoW in pairs(skillStagesW[skill]) do
                if(newLevel >= skillRateInfoW[1]) then
                skillRateW = skillRateInfoW[2]
            else
                break
            end
        end
        doPlayerSetRate(cid, skill, skillRateW)
        if(showInfoOnAdvance and skillRateW ~= oldRatesK[skill]) then
            if(skill >= 0 and skill <= 6) then
                configRateK = skillConfigW.skill
            else
                configRateK = skillConfigW.magiclevel
            end
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getPlayerNewSkillRatesText(cid))
        end
    end
    -- ROOKERS --
    elseif isRooker(cid) then
        if(skillStagesN[skill] ~= nil) then
            local skillRateW = 1
            local oldRatesK = getPlayerRates(cid)
            for i, skillRateInfoW in pairs(skillStagesN[skill]) do
                if(newLevel >= skillRateInfoW[1]) then
                skillRateW = skillRateInfoW[2]
            else
                break
            end
        end
        doPlayerSetRate(cid, skill, skillRateW)
        if(showInfoOnAdvance and skillRateW ~= oldRatesK[skill]) then
            if(skill >= 0 and skill <= 6) then
                configRateK = skillConfigN.skill
            else
                configRateK = skillConfigN.magiclevel
            end
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getPlayerNewSkillRatesText(cid))
        end
    end
    return true
end

In data\creaturescripts\scripts\ file skillstageslogin.lua:
Code:
dofile(getDataDir() .. "creaturescripts/scripts/stagesconfig.lua")

function isMage(cid)
    local voc = getPlayerVocation(cid)
    if voc == 1 or voc == 2 or voc == 5 or voc == 6 or voc == 9 or voc == 10 or voc == 13 or voc == 14 then
        return true
    else
        return false
    end
end

function isRanger(cid)
    local voc = getPlayerVocation(cid)
    if voc == 3 or voc == 7 or voc == 11 or voc == 15 then
        return true
    else
        return false
    end
end

function isWarrior(cid)
    local voc = getPlayerVocation(cid)
    if voc == 4 or voc == 8 or voc == 12 or voc == 6 or voc == 16 then
        return true
    else
        return false
    end
end

function isRooker(cid)
    local voc = getPlayerVocation(cid)
    if voc == 0 or voc == 17 or voc == 18 or voc == 19 or voc == 20 then
        return true
    else
        return false
    end
end

function onLogin(cid)
    local voc = getPlayerVocation(cid)
    -- Mage --
    if isMage(cid) then
        for skill, skillStageM in pairs(skillStagesM) do
            if(skill >= 0 and skill <= 6) then
                nowSkill = getPlayerSkillLevel(cid, skill)
            else
                nowSkill = getPlayerMagLevel(cid, true)
            end
        end
        for i, skillRateInfoM in pairs(skillStageM) do
            if(nowSkill >= skillRateInfoM[1]) then
                skillRateM = skillRateInfoM[2]
            else
                break
            end
        end
        doPlayerSetRate(cid, skill, skillRateM)
    -- Paladin --
    elseif isRanger(cid) then
        for skill, skillStageP in pairs(skillStagesR) do
            if(skill >= 0 and skill <= 6) then
                nowSkill = getPlayerSkillLevel(cid, skill)
            else
                nowSkill = getPlayerMagLevel(cid, true)
            end
        end
        for i, skillRateInfoP in pairs(skillStageP) do
            if(nowSkill >= skillRateInfoP[1]) then
                skillRateP = skillRateInfoP[2]
            else
                break
            end
        end
        doPlayerSetRate(cid, skill, skillRateP)
    -- Knight --
    elseif isKnight(cid) then
        for skill, skillStageK in pairs(skillStagesW) do
            if(skill >= 0 and skill <= 6) then
                nowSkill = getPlayerSkillLevel(cid, skill)
            else
                nowSkill = getPlayerMagLevel(cid, true)
            end
        end
        for i, skillRateInfoK in pairs(skillStageK) do
            if(nowSkill >= skillRateInfoK[1]) then
                skillRateK = skillRateInfoK[2]
            else
                break
            end
        end
        doPlayerSetRate(cid, skill, skillRateK)
    elseif isRooker(cid) then
        for skill, skillStageN in pairs(skillStageN) do
            if(skill >= 0 and skill <= 6) then
                nowSkill = getPlayerSkillLevel(cid, skill)
            else
                nowSkill = getPlayerMagLevel(cid, true)
            end
        end
        for i, skillRateInfoW in pairs(skillStageN) do
            if(nowSkill >= skillRateInfoW[1]) then
                skillRateW = skillRateInfoW[2]
            else
                break
            end
        end
        doPlayerSetRate(cid, skill, skillRateW)
    end


    if(showInfoOnLogin) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, getPlayerSkillRatesText(cid))
    end
    registerCreatureEvent(cid, "SkillStagesAdvance")
    return TRUE
end


In data/creaturescripts/creaturescripts.xml
Code:
<event type="login" name="SkillStagesLogin" event="script" value="skillstageslogin.lua"/>
<event type="advance" name="SkillStagesAdvance" event="script" value="skillstagesadvance.lua"/>

On player login i got this error, what is it?

Code:
[13:48:52.213] [Error - CreatureScript Interface]
[13:48:52.213] data/creaturescripts/scripts/skillstageslogin.lua:onLogin
[13:48:52.213] Description:
[13:48:52.213] data/creaturescripts/scripts/stagesconfig.lua:56: attempt to index global 'skillConfig' (a nil value)
[13:48:52.213] stack traceback:
[13:48:52.213]     data/creaturescripts/scripts/stagesconfig.lua:56: in function 'getPlayerSkillRatesText'
[13:48:52.213]     data/creaturescripts/scripts/skillstageslogin.lua:112: in function <data/creaturescripts/scripts/skillstageslogin.lua:39>
 
stagesconfig line #56

You have to reference the vocations config, so instead of "skillConfig.magiclevel" you will have to do "skillConfigM.magiclevel" for mages.

There is a better way to do what you did, but I'm too lazy to recreate the code, for now you should fix that line.
 
Srry guys idk what i'm doing XD
Just trying to put it to work

It was that what u guys said?

stagesconfig.lua
Code:
-- Skill Stages Mages --
skillConfigM = {skill = getConfigValue('rateSkill'), magiclevel = getConfigValue('rateMagic')}
skillStagesM = {}
skillStagesM[SKILL_FIST] = {{0,0}}
skillStagesM[SKILL_CLUB] = {{0,0.5}}
skillStagesM[SKILL_SWORD] = {{0,0.5}}
skillStagesM[SKILL_AXE] = {{0,0.5}}
skillStagesM[SKILL_DISTANCE] = {{0,0.5}}
skillStagesM[SKILL_SHIELD] = {{0,3},{15,2},{25,1}}
--skillStagesM[SKILL_FISHING] = {{0,5},{60,4},{80,3},{100,2},{110,1}}
skillStagesM[SKILL__MAGLEVEL] = {{0,1.0},{20,2.0},{30,3.0},{40,1.5},{50,1},{60,0.5}}

-- Skill Stages Paladin --
skillConfigR = {skill = getConfigValue('rateSkill'), magiclevel = getConfigValue('rateMagic')}
skillStagesR = {}
skillStagesR[SKILL_FIST] = {{0,0}}
skillStagesR[SKILL_CLUB] = {{0,0.5}}
skillStagesR[SKILL_SWORD] = {{0,0.5}}
skillStagesR[SKILL_AXE] = {{0,0.5}}
skillStagesR[SKILL_DISTANCE] = {{0,3},{4,2},{9,1},{15,0.5}}
skillStagesR[SKILL_SHIELD] = {{0,3},{40,1},{60,0.5}}
--skillStagesR[SKILL_FISHING] = {{0,5},{60,4},{80,3},{100,2},{110,1}}
skillStagesR[SKILL__MAGLEVEL] = {{0,3},{4,2},{9,1},{15,0.5}}

-- Skill Stages Knight --
skillConfigW = {skill = getConfigValue('rateSkill'), magiclevel = getConfigValue('rateMagic')}
skillStagesW = {}
skillStagesW[SKILL_FIST] = {{0,0}}
skillStagesW[SKILL_CLUB] = {{0,3},{40,2},{60,1},{80,0.5}}
skillStagesW[SKILL_SWORD] = {{0,3},{40,2},{60,1},{80,0.5}}
skillStagesW[SKILL_AXE] = {{0,3},{40,2},{60,1},{80,0.5}}
skillStagesW[SKILL_DISTANCE] = {{0,0.5}}
skillStagesW[SKILL_SHIELD] = {{0,3},{40,2},{60,1},{80,0.5}}
--skillStagesW[SKILL_FISHING] = {{0,5},{60,4},{80,3},{100,2},{110,1}}
skillStagesW[SKILL__MAGLEVEL] = {{0,3},{4,2},{6,1},{9,0.5}}

-- Skill Stages Rooker (None) --
skillConfigN = {skill = getConfigValue('rateSkill'), magiclevel = getConfigValue('rateMagic')}
skillStagesN = {}
skillStagesN[SKILL_FIST] = {{0,0}}
skillStagesN[SKILL_CLUB] = {{0,5},{10,4},{15,3},{20,2},{25,1},{30,0.5}}
skillStagesN[SKILL_SWORD] = {{0,5},{10,4},{15,3},{20,2},{25,1},{30,0.5}}
skillStagesN[SKILL_AXE] = {{0,5},{10,4},{15,3},{20,2},{25,1},{30,0.5}}
skillStagesN[SKILL_DISTANCE] = {{0,5},{10,4},{15,3},{20,2},{25,1},{30,0.5}}
skillStagesN[SKILL_SHIELD] = {{0,5},{10,4},{15,3},{20,2},{25,1},{30,0.5}}
--skillStagesW[SKILL_FISHING] = {{0,5},{60,4},{80,3},{100,2},{110,1}}
skillStagesN[SKILL__MAGLEVEL] = {{0,0}}


showInfoOnAdvance = true -- send player message about skill rate change
showInfoOnLogin = true -- send player message about skill rates when he login
 
function getPlayerSkillRatesText(cid)
 local skillInfo = getPlayerRates(cid)
 if isMage(cid) then
     return "YOUR RATES: [ Magic Level: " .. skillInfo[SKILL__MAGLEVEL] * skillConfigM.magiclevel .. "x || Fist: " .. skillInfo[SKILL_FIST] * skillConfigM.skill .. "x | Club: " .. skillInfo[SKILL_CLUB] * skillConfigM.skill .. "x |  Sword: " .. skillInfo[SKILL_SWORD] * skillConfigM.skill .. "x | Axe: " .. skillInfo[SKILL_AXE] * skillConfigM.skill .. "x |  Distance: " .. skillInfo[SKILL_DISTANCE] * skillConfigM.skill .. " | Shielding: " .. skillInfo[SKILL_SHIELD] * skillConfigM.skill .. "x | Fishing: " .. skillInfo[SKILL_FISHING] * skillConfigM.skill .. "x ]"
 elseif isRanger(cid) then
     return "YOUR RATES: [ Magic Level: " .. skillInfo[SKILL__MAGLEVEL] * skillConfigR.magiclevel .. "x || Fist: " .. skillInfo[SKILL_FIST] * skillConfigR.skill .. "x | Club: " .. skillInfo[SKILL_CLUB] * skillConfigR.skill .. "x |  Sword: " .. skillInfo[SKILL_SWORD] * skillConfigR.skill .. "x | Axe: " .. skillInfo[SKILL_AXE] * skillConfigR.skill .. "x |  Distance: " .. skillInfo[SKILL_DISTANCE] * skillConfigR.skill .. " | Shielding: " .. skillInfo[SKILL_SHIELD] * skillConfigR.skill .. "x | Fishing: " .. skillInfo[SKILL_FISHING] * skillConfigR.skill .. "x ]"
 elseif isWarrior(cid) then
     return "YOUR RATES: [ Magic Level: " .. skillInfo[SKILL__MAGLEVEL] * skillConfigW.magiclevel .. "x || Fist: " .. skillInfo[SKILL_FIST] * skillConfigW.skill .. "x | Club: " .. skillInfo[SKILL_CLUB] * skillConfigW.skill .. "x |  Sword: " .. skillInfo[SKILL_SWORD] * skillConfigW.skill .. "x | Axe: " .. skillInfo[SKILL_AXE] * skillConfigW.skill .. "x |  Distance: " .. skillInfo[SKILL_DISTANCE] * skillConfigW.skill .. " | Shielding: " .. skillInfo[SKILL_SHIELD] * skillConfigW.skill .. "x | Fishing: " .. skillInfo[SKILL_FISHING] * skillConfigW.skill .. "x ]"
 elseif isRooker(cid) then
     return "YOUR RATES: [ Magic Level: " .. skillInfo[SKILL__MAGLEVEL] * skillConfigN.magiclevel .. "x || Fist: " .. skillInfo[SKILL_FIST] * skillConfigN.skill .. "x | Club: " .. skillInfo[SKILL_CLUB] * skillConfigN.skill .. "x |  Sword: " .. skillInfo[SKILL_SWORD] * skillConfigN.skill .. "x | Axe: " .. skillInfo[SKILL_AXE] * skillConfigN.skill .. "x |  Distance: " .. skillInfo[SKILL_DISTANCE] * skillConfigN.skill .. " | Shielding: " .. skillInfo[SKILL_SHIELD] * skillConfigN.skill .. "x | Fishing: " .. skillInfo[SKILL_FISHING] * skillConfigN.skill .. "x ]"
 end
end

skillstageslogin.lua
Code:
dofile(getDataDir() .. "creaturescripts/scripts/stagesconfig.lua")

function onLogin(cid)
    local voc = getPlayerVocation(cid)
    -- Mage --
    if isMage(cid) then
        for skill, skillStageM in pairs(skillStagesM) do
            if(skill >= 0 and skill <= 6) then
                nowSkill = getPlayerSkillLevel(cid, skill)
            else
                nowSkill = getPlayerMagLevel(cid, true)
            end
        end
        for i, skillRateInfoM in pairs(skillStageM) do
            if(nowSkill >= skillRateInfoM[1]) then
                skillRateM = skillRateInfoM[2]
            else
                break
            end
        end
        doPlayerSetRate(cid, skill, skillRateM)
    -- Paladin --
    elseif isRanger(cid) then
        for skill, skillStageP in pairs(skillStagesR) do
            if(skill >= 0 and skill <= 6) then
                nowSkill = getPlayerSkillLevel(cid, skill)
            else
                nowSkill = getPlayerMagLevel(cid, true)
            end
        end
        for i, skillRateInfoP in pairs(skillStageP) do
            if(nowSkill >= skillRateInfoP[1]) then
                skillRateP = skillRateInfoP[2]
            else
                break
            end
        end
        doPlayerSetRate(cid, skill, skillRateP)
    -- Knight --
    elseif isKnight(cid) then
        for skill, skillStageK in pairs(skillStagesW) do
            if(skill >= 0 and skill <= 6) then
                nowSkill = getPlayerSkillLevel(cid, skill)
            else
                nowSkill = getPlayerMagLevel(cid, true)
            end
        end
        for i, skillRateInfoK in pairs(skillStageK) do
            if(nowSkill >= skillRateInfoK[1]) then
                skillRateK = skillRateInfoK[2]
            else
                break
            end
        end
        doPlayerSetRate(cid, skill, skillRateK)
    elseif isRooker(cid) then
        for skill, skillStageN in pairs(skillStageN) do
            if(skill >= 0 and skill <= 6) then
                nowSkill = getPlayerSkillLevel(cid, skill)
            else
                nowSkill = getPlayerMagLevel(cid, true)
            end
        end
        for i, skillRateInfoW in pairs(skillStageN) do
            if(nowSkill >= skillRateInfoW[1]) then
                skillRateW = skillRateInfoW[2]
            else
                break
            end
        end
        doPlayerSetRate(cid, skill, skillRateW)
    end


    if(showInfoOnLogin) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, getPlayerSkillRatesText(cid))
    end
    registerCreatureEvent(cid, "SkillStagesAdvance")
    return TRUE
end

skillstageadvance.lua
Code:
dofile(getDataDir() .. "creaturescripts/scripts/stagesconfig.lua")

function onAdvance(cid, skill, oldLevel, newLevel)
    -- Mage --
    if isMage(cid) then
        if(skillStagesM[skill] ~= nil) then
        local skillRateM = 1
        local oldRatesM = getPlayerRates(cid)
        for i, skillRateInfoM in pairs(skillStagesM[skill]) do
            if(newLevel >= skillRateInfoM[1]) then
                skillRateM = skillRateInfoM[2]
            else
                break
            end
        end
        doPlayerSetRate(cid, skill, skillRateM)
        if(showInfoOnAdvance and skillRateM ~= oldRatesM[skill]) then
            if(skill >= 0 and skill <= 6) then
                configRateM = skillConfigM.skill
            else
                configRateM = skillConfigM.magiclevel
            end
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getPlayerNewSkillRatesText(cid))
        end
    -- Paladin --
    elseif isRanger(cid) then
        if(skillStagesR[skill] ~= nil) then
            local skillRateP = 1
            local oldRatesP = getPlayerRates(cid)
            for i, skillRateInfoP in pairs(skillStagesR[skill]) do
                if(newLevel >= skillRateInfoP[1]) then
                    skillRateP = skillRateInfoP[2]
                else
                    break
                end
            end
        end
        doPlayerSetRate(cid, skill, skillRateP)
        if(showInfoOnAdvance and skillRateP ~= oldRatesP[skill]) then
        if(skill >= 0 and skill <= 6) then
            configRateP = skillConfigR.skill
        else
            configRateP = skillConfigR.magiclevel
        end
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getPlayerNewSkillRatesText(cid))
    -- Knight --
    elseif isWarrior(cid) then
        if(skillStagesW[skill] ~= nil) then
            local skillRateW = 1
            local oldRatesK = getPlayerRates(cid)
            for i, skillRateInfoW in pairs(skillStagesW[skill]) do
                if(newLevel >= skillRateInfoW[1]) then
                skillRateW = skillRateInfoW[2]
            else
                break
            end
        end
        doPlayerSetRate(cid, skill, skillRateW)
        if(showInfoOnAdvance and skillRateW ~= oldRatesK[skill]) then
            if(skill >= 0 and skill <= 6) then
                configRateK = skillConfigW.skill
            else
                configRateK = skillConfigW.magiclevel
            end
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getPlayerNewSkillRatesText(cid))
        end
    end
    -- ROOKERS --
    elseif isRooker(cid) then
        if(skillStagesN[skill] ~= nil) then
            local skillRateW = 1
            local oldRatesK = getPlayerRates(cid)
            for i, skillRateInfoW in pairs(skillStagesN[skill]) do
                if(newLevel >= skillRateInfoW[1]) then
                skillRateW = skillRateInfoW[2]
            else
                break
            end
        end
        doPlayerSetRate(cid, skill, skillRateW)
        if(showInfoOnAdvance and skillRateW ~= oldRatesK[skill]) then
            if(skill >= 0 and skill <= 6) then
                configRateK = skillConfigN.skill
            else
                configRateK = skillConfigN.magiclevel
            end
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, getPlayerNewSkillRatesText(cid))
        end
    end
    return true
end

why when i login with knights(warriors) i can login with no errors
but print this:
09:25 YOUR RATES: [ Magic Level: 1x || Fist: 1x | Club: 1x | Sword: 1x | Axe: 1x | Distance: 1 | Shielding: 1x | Fishing: 1x ]

and when i try to login with mages or paladins or rookers it shows errors like:
paladin:
Code:
[9:28:26.787] [Error - CreatureScript Interface] 
[9:28:26.787] data/creaturescripts/scripts/skillstageslogin.lua:onLogin
[9:28:26.787] Description: 
[9:28:26.787] data/creaturescripts/scripts/skillstageslogin.lua:31: bad argument #1 to 'pairs' (table expected, got nil)
[9:28:26.787] stack traceback:
[9:28:26.788]     [C]: in function 'pairs'
[9:28:26.788]     data/creaturescripts/scripts/skillstageslogin.lua:31: in function <data/creaturescripts/scripts/skillstageslogin.lua:3>

mage:
Code:
[9:29:11.575] [Error - CreatureScript Interface] 
[9:29:11.575] data/creaturescripts/scripts/skillstageslogin.lua:onLogin
[9:29:11.575] Description: 
[9:29:11.575] data/creaturescripts/scripts/skillstageslogin.lua:14: bad argument #1 to 'pairs' (table expected, got nil)
[9:29:11.575] stack traceback:
[9:29:11.575]     [C]: in function 'pairs'
[9:29:11.575]     data/creaturescripts/scripts/skillstageslogin.lua:14: in function <data/creaturescripts/scripts/skillstageslogin.lua:3>

rooker:
Code:
[9:29:32.595] [Error - CreatureScript Interface] 
[9:29:32.595] data/creaturescripts/scripts/skillstageslogin.lua:onLogin
[9:29:32.595] Description: 
[9:29:32.595] data/creaturescripts/scripts/skillstageslogin.lua:57: bad argument #1 to 'pairs' (table expected, got nil)
[9:29:32.595] stack traceback:
[9:29:32.595]     [C]: in function 'pairs'
[9:29:32.595]     data/creaturescripts/scripts/skillstageslogin.lua:57: in function <data/creaturescripts/scripts/skillstageslogin.lua:3>
 
Back
Top