Stellow
C++/C#/PHP/LUA
Request, Reward Premium Points on level
Like, lvl 180 reward 30 premium points
Thanks and Good Bye
Like, lvl 180 reward 30 premium points
Thanks and Good Bye
local t, storage = {
-- level -- amount points (delete this line)..
{100, 100},
{200, 70},
{300, 65},
{400, 50},
{500, 40}
}, 259
function onAdvance(cid, skill, oldLevel, newLevel)
if skill ~= SKILL__LEVEL then
return true
end
for i = 1, #t do
local v = t[i]
if newLevel >= v[1] and getCreatureStorage(cid, storage) < i then
db.executeQuery('UPDATE accounts SET premium_points=premium_points+'.. v[2] ..' WHERE id=' .. getPlayerAccountId(cid))
doCreatureSetStorage(cid, storage, i)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, 'Congratulations! You have advanced to level ' .. v[1] .. ' and you have earned '.. v[2] ..' Premium Points!')
end
end
return true
end
<event type="advance" name="pointsforlvl" event="script" value="name.lua"/>
registerCreatureEvent(cid, "pointsforlvl")
function onThink(cid, interval)
if getPlayerLevel(cid) >= 180 then
if getPlayerStorageValue(cid,2347) < 1 then
db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + 30 WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
setPlayerStorageValue(cid,2347,1)
doSendAnimatedText(getPlayerPosition(cid), "Reward", TEXTCOLOR_LIGHTBLUE)
end
end
return TRUE
end
-- level -- amount points (delete this line)..
{100, 100},
{200, 70},
{300, 65},
{400, 50},
{500, 40}
}, 259