• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Reward on advance for TFS 1.0

ATT3

Intermediate OT User
Joined
Sep 22, 2010
Messages
512
Reaction score
100
For example: Player X advances level 20, gets 2 crystal coins.

There are many scripts but none of them seem to work on TFS 1.0
 
It only gave me the reward once when I tested the script, have you tried with another character?
 
I don't really know about 1.0 since I haven't it tried yet... But don't use that script if you are going to make a high/mid exp serv.
 
It only gave me the reward once when I tested the script, have you tried with another character?

Yeah I have, even with different account.
Now it gave 5x first reward, 3x second like before. (seems to be random?)

Any idea what could be causing it for me? Bad rev or something?
Btw thanks alot for your help. :)
 
Code:
local t, storage = {
    {20, 2160, 2},
    {30, 2160, 3},
    {40, 2160, 5}
}, 1234

function onAdvance(cid, skill, oldLevel, newLevel)
    local player = Player(cid)
    if skill ~= SKILL_LEVEL then
        return true
    end
   
    for i = 1, #t do
    local v = t[i]
        if newLevel >= v[1] and player:getStorageValue(storage) < i then
            player:addItem(v[2], v[3])
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have been rewarded with " .. (isItemStackable(v[2]) and v[3] .. "" or getItemDescriptions(v[2]).article ~= "" and getItemDescriptions(v[2]).article .. " " or "") .. " " .. getItemDescriptions(v[2]).plural .. " for reaching level " .. v[1] .. "!")
            player:setStorageValue(storage, i)
            break
        end
    end
    return true
end
 
Code:
local t, storage = {
    {20, 2160, 2},
    {30, 2160, 3},
    {40, 2160, 5}
}, 1234

function onAdvance(cid, skill, oldLevel, newLevel)
    local player = Player(cid)
    if skill ~= SKILL_LEVEL then
        return true
    end
  
    for i = 1, #t do
    local v = t[i]
        if newLevel >= v[1] and player:getStorageValue(storage) < i then
            player:addItem(v[2], v[3])
            player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have been rewarded with " .. (isItemStackable(v[2]) and v[3] .. "" or getItemDescriptions(v[2]).article ~= "" and getItemDescriptions(v[2]).article .. " " or "") .. " " .. getItemDescriptions(v[2]).plural .. " for reaching level " .. v[1] .. "!")
            player:setStorageValue(storage, i)
            break
        end
    end
    return true
end

Yeah this will do just fine.
Thanks.
 
Back
Top