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

TFS 0.X More options referrel

newby

Active Member
Joined
Jun 11, 2016
Messages
183
Reaction score
43
How to add more lvl options

I mean, lvl 10 = 5 points 250888
lvl 20 = 10 points 250889
lvl 30 = 15 points 250890

Code:
local cfg = {
    stor = 250888,
    requiredLevel = 10,
    bonusPoints = 5
}


function onAdvance(cid, skill, oldLevel, newLevel)
    if (newLevel == cfg.requiredLevel and skill == SKILL__LEVEL) and getPlayerStorageValue(cid, cfg.stor) < 1 then
        local accountId = getPlayerAccountId(cid)
   
        local resultId = db.storeQuery("SELECT `ref_key` FROM `__cornex_referral_actions` WHERE `registered_by` = " .. accountId .. " AND `blocked` = 0")
        if resultId then
            print(resultId)
            local resultId2 = db.storeQuery("SELECT `belongs_to` FROM `__cornex_referral` WHERE `referral_key` = '" .. result.getDataString(resultId, "ref_key") .. "'")
            print(resultId2)
            if resultId2 then
                db.executeQuery("UPDATE `__cornex_referral_actions` SET `blocked` = 1 WHERE `registered_by` = " .. accountId)
                db.executeQuery("UPDATE `znote_accounts` SET `points` = (points + " .. cfg.bonusPoints .. ") WHERE `account_id` = '" .. result.getDataInt(resultId2, "belongs_to") .. "'")
                print('-> account id: ' .. result.getDataInt(resultId2, "belongs_to"))
                print('-> added ' .. cfg.bonusPoints .. ' points.')
                result.free(resultId2)
            else
                print("Missing ref_key in `__cornex_referral` where ref_key = " .. result.getDataString(resultId, "ref_key"))
            end
            result.free(resultId)
        end
    end
    return true
end

This script is a 0.4 version from: [Znote AAC][TFS 1.1] Referral system (https://otland.net/threads/znote-aac-tfs-1-1-referral-system.227199/)
 
Back
Top