yes ,on sitePremium Points ?
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
yes but this not from 20 to 50 just will get prize in this levelis 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
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