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

Request, Reward Premium Points on level

data/creaturescripts/scripts/name.lua
PHP:
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

data/creaturescripts/creaturescripts.xml
PHP:
<event type="advance" name="pointsforlvl" event="script" value="name.lua"/>

data/creaturescripts/scripts/login.lua , end of file , add this:
PHP:
        registerCreatureEvent(cid, "pointsforlvl")
 
Grrr!!!
I just make my script :(

I know its simple/long blablabla but i think its works...

creaturescripts:

Lua:
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
 
Back
Top