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

Premium-Points for Level Up TFS 1.2

hellyea

OT-Fan
Joined
Jan 26, 2009
Messages
92
Reaction score
6
Location
Germany
Hey guys,

since no1 helped in the Support section i have to ask here i guess.

Is there a Script for free points on lvl advance for 1.2 gesior 2012?

Thanks
 
use this in script advance
Lua:
function doPlayerAddPremiumPoints(cid, points)
   return db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + ".. points .." WHERE `id` = '" ..getPlayerAccountId(cid).. "';")
end
 
Last edited by a moderator:
Add this to your creaturescripts.xml file;
XML:
<event type="advance" name="lvlReward" script="custom/advance.lua" />

Now enter the scripts folder, create a new folder called custom and in there create a file called advance.lua.
The server will now try to load that script, but we need to add some code in that script to make it work;

Lua:
local rewards = {
    -- Level, points
    {160, 5},
    {200, 10},
    {245, 15}
}

function onAdvance(player, skill, oldLevel, newLevel)
    if skill ~= SKILL__LEVEL then
        return true
    end
 
    for i = 1, #rewards do
        local reward = rewards[i]
        if newLevel >= reward[1] and player:getStorageValue(21352) < i then
            db.query("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. reward[2] .. " WHERE `id` = '" .. player:getAccountId() .. "';")
            player:setStorageValue(21352, i)
            player:sendTextMessage(MESSAGE_STATUS_CONSOLE_ORANGE, 'Congratulations! You have advanced to level ' .. reward[1] .. ' and you have earned '.. reward[2] ..' points!')
            break
        end
    end
    return true
end

After you added that code to the advance.lua file you can reload / restart the server and it should work fine.
 
Back
Top