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

points

Misokoko

New Member
Joined
Mar 29, 2013
Messages
126
Reaction score
0
I Need Points scripts (levelxx get xx points) but for the account not to the char
 
Tfs version?

If 0.3.6 or 0.4 this might work
Code:
function onAdvance(cid, skill, oldLevel, newLevel)

local config = {
[20] = {count = 3},
[50] = {count = 5},
}

if skill == 8 then
for level, info in pairs(config) do
if newLevel >= level and (getPlayerStorageValue(cid, 30700) == -1 or not (string.find(getPlayerStorageValue(cid, 30700), "'" .. level .. "'"))) then
db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + "..count.." WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
doPlayerSendTextMessage(cid, 27, "Congratulations! You have reached level "..newLevel.." and have been rewarded with "..count.." premium points.")
local sat = getPlayerStorageValue(cid, 30700) == -1 and "Values: '" .. level .. "'" or getPlayerStorageValue(cid, 30700) .. ",'" .. level .. "'"
setPlayerStorageValue(cid, 30700, sat)
end
end
end

return TRUE
end
 
Tfs version?

If 0.3.6 or 0.4 this might work
Code:
function onAdvance(cid, skill, oldLevel, newLevel)

local config = {
[20] = {count = 3},
[50] = {count = 5},
}

if skill == 8 then
for level, info in pairs(config) do
if newLevel >= level and (getPlayerStorageValue(cid, 30700) == -1 or not (string.find(getPlayerStorageValue(cid, 30700), "'" .. level .. "'"))) then
db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + "..count.." WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
doPlayerSendTextMessage(cid, 27, "Congratulations! You have reached level "..newLevel.." and have been rewarded with "..count.." premium points.")
local sat = getPlayerStorageValue(cid, 30700) == -1 and "Values: '" .. level .. "'" or getPlayerStorageValue(cid, 30700) .. ",'" .. level .. "'"
setPlayerStorageValue(cid, 30700, sat)
end
end
end

return TRUE
end

is the level 20,50 like that ??
 
function onAdvance(cid, skill, oldLevel, newLevel) local config = { [20] = {count = 3}, [50] = {count = 5}, } if skill == 8 then for level, info in pairs(config) do if newLevel >= level and (getPlayerStorageValue(cid, 30700) == -1 or not (string.find(getPlayerStorageValue(cid, 30700), "'" .. level .. "'"))) then db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + "..count.." WHERE `id` = " .. getPlayerAccountId(cid) .. ";") doPlayerSendTextMessage(cid, 27, "Congratulations! You have reached level "..newLevel.." and have been rewarded with "..count.." premium points.") local sat = getPlayerStorageValue(cid, 30700) == -1 and "Values: '" .. level .. "'" or getPlayerStorageValue(cid, 30700) .. ",'" .. level .. "'" setPlayerStorageValue(cid, 30700, sat) end end end return TRUE end

doesn't work :/
 
Code:
function doAddPoints(cid, points)
db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. points .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
end

local config = {
    {level = 250, storage = 89964, reward = 2160, howmanyreward = 5},
    {level = 300, storage = 89965, reward = 2160, howmanyreward = 8},
    {level = 330, storage = 89966, reward = 2160, howmanyreward = 10}
    }
function onAdvance(cid, skill, oldLevel, newLevel)
    for i = 1, #config do
        if(getPlayerStorageValue(cid, config[i].storage) ~= 1 and getPlayerLevel(cid) >= config[i].level) then
                local itemname = getItemNameById(config[i].reward)
                doAddPoints(cid, config[i].howmanyreward)
                setPlayerStorageValue(cid, config[i].storage, 1)
                doPlayerSendTextMessage(cid, 22, "You have gained " .. config[i].howmanyreward .. " premium points for advancing to level " .. config[i].level .. ".")
        end
    end
        return TRUE
end
 
Back
Top