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

Give Level

_Aion_

Nothing Else
Joined
Jan 19, 2010
Messages
400
Solutions
4
Reaction score
10
Location
Jequie,Bahia,Brazil
Hello, i need some script that give level for all player.
Example of script: i'm in level 20, the system will checks that if i'm in level 20, if is true, their put in level 21.
all player will give one level.
i'm making an script but have error.
Code:
maximum = {   
player = getPlayerGUID(cid),   
lvlmax = 21,
  }

local function giveLevel(cid, quant)
if getPlayerStorageValue(cid, 252526) == 0 then
else
if getPlayerLevel(cid) ~= 20 then
doRemoveCreature(cid)
db.executeQuery("UPDATE `players` SET `level` = "..maximum.lvlmax..", `experience` = 0 WHERE `id` = "..maximum.player)
end
return true
end
end

function onThink(interval)
for i, v in pairs(getPlayersOnline()) do
giveLevel(v, maximum.lvlmax)
end
return true
end
 
Code:
(6, 7)if getPlayerStorageValue(cid, 252526) == 0 then
else
^ Error.

Do you want to give level only to players that are level 20? Or all the players?

Try this:

Code:
function onThink(interval)
local round == TRUE --If the player will go to the next level at 0% or if he will get the amount of exp needed to go to the next level (0 to 100%).
    for i, v in pairs(getPlayersOnline()) do
    if getPlayerLevel(v) == 20 and getPlayerStorageValue(v, 252526) == 0 then
        return doPlayerAddLevel(v, 1, round) and setPlayerStorageValue(v, 252526, 1)
    else
         return false
    end
    end
return true
end

If you do not have the funcion doPlayerAddLevel(cid, amount, round), add this in libs/050-funcion.lua
Code:
function doPlayerAddLevel(cid, amount, round)
    local experience, level = 0, getPlayerLevel(cid)
    if(amount > 0) then
        experience = getExperienceForLevel(level + amount) - (round and getPlayerExperience(cid) or getExperienceForLevel(level))
    else
        experience = -((round and getPlayerExperience(cid) or getExperienceForLevel(level)) - getExperienceForLevel(level + amount))
    end

    return doPlayerAddExperience(cid, experience)
end
 
Then:
Code:
function onThink(interval)
local round == TRUE --If the player will go to the next level at 0% or if he will get the amount of exp needed to go to the next level (0 to 100%).
    for i, v in pairs(getPlayersOnline()) do
    if getPlayerStorageValue(v, 252526) == 0 then
        return doPlayerAddLevel(v, 1, round) and setPlayerStorageValue(v, 252526, 1)
    else
         return false
    end
    end
return true
end
 
Back
Top