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

Reward level system [creaturescripts]

Grillo1995

New Member
Joined
Feb 8, 2018
Messages
21
Solutions
1
Reaction score
1
Location
Brazil
Hi, I have this level reward script.

Code:
local crystal = 2160
local storage = 6095789
local storage2 = 6095790
local storage3 = 6095791

function onAdvance(player, skill, oldlevel, newlevel)
    if newlevel >= 30  and player:getStorageValue(storage) ~= 10 then
        player:setStorageValue(storage, 10)
        player:setBankBalance(player:getBankBalance() + 10000)
        --player:addItem(crystal, 1)
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You receive 1 crystal coin in your bank.")
    elseif newlevel >= 60  and player:getStorageValue(storage2) ~= 10 then
        player:setStorageValue(storage2, 10)
        player:setBankBalance(player:getBankBalance() + 30000)
        --player:addItem(crystal, 3)
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You receive 3 crystal coin in your bank.")
    elseif newlevel >= 100  and player:getStorageValue(storage3) ~= 10 then
        player:setStorageValue(storage3, 10)
        player:setBankBalance(player:getBankBalance() + 60000)
        --player:addItem(crystal, 6)
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You receive 6 crystal coin in your bank.")
    end
    return true
end

function onLogin(player)
    player:registerEvent("onadvance_reward")
    return true
end

It works well, but if the player gets skill 30 he wins the first prize too, the script counts both level and up skills / ml.

How do I only win if I actually level LEVEL OF CHARACTER, not ML and skills? Thanks.

function onAdvance(player, level, oldlevel, newlevel)

Dont work for me ..
 
Last edited:
Solution
Code:
local crystal = 2160
local storage = 6095789
local storage2 = 6095790
local storage3 = 6095791

function onAdvance(player, skill, oldlevel, newlevel)
    if skill ~= SKILL__LEVEL then
        return true
    end

    if newlevel >= 30  and player:getStorageValue(storage) ~= 10 then
        player:setStorageValue(storage, 10)
        player:setBankBalance(player:getBankBalance() + 10000)
        --player:addItem(crystal, 1)
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You receive 1 crystal coin in your bank.")
    elseif newlevel >= 60  and player:getStorageValue(storage2) ~= 10 then
        player:setStorageValue(storage2, 10)
        player:setBankBalance(player:getBankBalance() + 30000)...
Code:
local crystal = 2160
local storage = 6095789
local storage2 = 6095790
local storage3 = 6095791

function onAdvance(player, skill, oldlevel, newlevel)
    if skill ~= SKILL__LEVEL then
        return true
    end

    if newlevel >= 30  and player:getStorageValue(storage) ~= 10 then
        player:setStorageValue(storage, 10)
        player:setBankBalance(player:getBankBalance() + 10000)
        --player:addItem(crystal, 1)
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You receive 1 crystal coin in your bank.")
    elseif newlevel >= 60  and player:getStorageValue(storage2) ~= 10 then
        player:setStorageValue(storage2, 10)
        player:setBankBalance(player:getBankBalance() + 30000)
        --player:addItem(crystal, 3)
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You receive 3 crystal coin in your bank.")
    elseif newlevel >= 100  and player:getStorageValue(storage3) ~= 10 then
        player:setStorageValue(storage3, 10)
        player:setBankBalance(player:getBankBalance() + 60000)
        --player:addItem(crystal, 6)
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, "You receive 6 crystal coin in your bank.")
    end
    return true
end

function onLogin(player)
    player:registerEvent("onadvance_reward")
    return true
end
 
Solution
Back
Top