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

Help to add premium days on refereal system 0.4

samandriel

Active Member
Joined
Oct 19, 2016
Messages
242
Solutions
1
Reaction score
46
I need a help to use this system:
https://otland.net/threads/znote-aac-tfs-1-1-referral-system.227199/#post-2405828
Converted to 0.4
Code:
local cfg = {
    stor = 250888,
    requiredLevel = 13,
    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

But i don't want to it add donate points
I want it add premium days
But i don't know this mysql thing and i need a help..

Anyone know how to do?
 
change thie line
Code:
 db.executeQuery("UPDATE `znote_accounts` SET `points` = (points
to
Code:
doPlayerAddPremiumDays(cid, 1)
that will add one premium day

and remove this
Code:
            print('-> added ' .. cfg.bonusPoints .. ' points.')
 
change thie line
Code:
 db.executeQuery("UPDATE `znote_accounts` SET `points` = (points
to
Code:
doPlayerAddPremiumDays(cid, 1)
that will add one premium day

and remove this
Code:
            print('-> added ' .. cfg.bonusPoints .. ' points.')

It not gonna work, its necessary a SQL command to player/accountid...
This function:
Code:
doPlayerAddPremiumDays(cid, 1)

cid need a player online
 
Back
Top