• 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!

Max Level

115820

Member
Joined
Feb 27, 2011
Messages
193
Solutions
1
Reaction score
5
Location
London, England
Hi, i want a script when player get level 500,000 him stop up level. When he get lvl 510,000, back level 500,00.

I use TFS 0.4, Tibia Version 8.6

Sorry my english.
 
Last edited:
Lua:
function onAdvance(cid, skill, oldLevel, newLevel)
        if getPlayerLevel(cid) > 500000 then
                doPlayerAddLevel(cid, -1)
        end
        return TRUE
end
try something like this lol, if its not good enough i'll fix it later on when im not busy
 
test
Lua:
local maxLevel = 999
function onAdvance(cid, skill, oldLevel, newLevel)
    if (skill == SKILL__LEVEL and newLevel > maxLevel) then
        return false
    end
    return true
end
 
Lua:
local maxLevel = 999
function onAdvance(cid, skill, oldLevel, newLevel)
    if (skill == SKILL__LEVEL and newLevel >= maxLevel) then
        newLevel = maxLevel
    end
    return true
end
 
you're reassigning the variable, which does nothing
you need to subtract the newLevel with the maxLevel and reduce player exp according to how much the exp difference is between newLevel-maxLevel
getExpForLevel(lv) should already be included in 0.4 and should help calculate exp
after that i think doPlayerAddExperience(-getExpForLevel(lv)) should work
 
Lua:
function onAdvance(cid, skill, oldlevel, newlevel)
 if(skill == SKILL__LEVEL) then
  if getPlayerLevel(cid) >= 500000 then
   doPlayerAddExperience(cid, (getExperienceForLevel(500000) - getPlayerExperience(cid)))
  end
 end
 return true
end
 
Lua:
function onAdvance(cid, skill, oldlevel, newlevel)
 if(skill == SKILL__LEVEL) then
  if getPlayerLevel(cid) >= 500000 then
   doPlayerAddExperience(cid, (getExperienceForLevel(500000) - getPlayerExperience(cid)))
  end
 end
 return true
end
you should add negative experience rather than adding it onto the exp he already has
also why use SKILL__MAGLEVEL? this is for SKILL__LEVEL only

Lua:
local maxLevel = 500000

function onAdvance(cid, skill, oldlevel, newlevel)
    if skill == SKILL__LEVEL and newLevel >= maxLevel then
        doPlayerAddLevel(cid, -(newLevel - maxLevel))
    end
    return true
end
 
Last edited:
you should add negative experience rather than adding it onto the exp he already has
also why use SKILL__MAGLEVEL? this is for SKILL__LEVEL only

Lua:
local maxLevel = 500000

function onAdvance(cid, skill, oldlevel, newlevel)
    if skill == SKILL__LEVEL and newLevel >= maxLevel then
        doPlayerAddLevel(cid, -(newLevel - maxLevel))
    end
    return true
end
Dont WORK. ERROr
 
you should add negative experience rather than adding it onto the exp he already has
also why use SKILL__MAGLEVEL? this is for SKILL__LEVEL only

Lua:
local maxLevel = 500000

function onAdvance(cid, skill, oldlevel, newlevel)
    if skill == SKILL__LEVEL and newLevel >= maxLevel then
        doPlayerAddLevel(cid, -(newLevel - maxLevel))
    end
    return true
end
L to l
 
Back
Top