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

Add Shop Points, if player get level 160, 180, 200, 220 ....

smstR

offline, bye
Joined
Nov 2, 2007
Messages
95
Reaction score
0
Hello otlanders,


im searching for a script, which adds Donation Points if X player reach X level. Im using Gesior + 0.4 tfs.

For example:
Player XY reach level 180. He get automatic 200 Premium Points. Also there have to be a server adversment like /b Player XY reached level 180. You got 200 Premium Points to your account, Congratulations!


Thanks for your attention,
all the best,
smstR
 
Lua:
function onAdvance(cid, skill, oldLevel, newLevel)
	if getPlayerNewLevel(cid) == 180 then
		db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + 200 WHERE `id` = "..getPlayerAccountId(cid)..";"
		doBroadastMessage("Player: " ..getCreatureName(cid).." has reached level 180 and is therefor rewarded with 200 premium points!")
	end
	return true
end
 
Last edited:
Lua:
function onAdvance(cid, skill, oldLevel, newLevel)
	if newLevel >= 180 and getCreatureStorage(cid, 234) == -1 then
		doCreatureSetStorage(cid, 234, 1)
		db.executeQuery('UPDATE accounts SET premium_points=premium_points+200 WHERE id=' .. getPlayerAccountId(cid))
		doBroadastMessage(getCreatureName(cid) .. ' has reached level 180 and is therefore rewarded with 200 premium points!')
	end
	return true
end
 
Could this work?



Lua:
function onAdvance(cid, skill, oldLevel, newLevel)
        if newLevel >= 180 and getCreatureStorage(cid, 234) == -1 then
                doCreatureSetStorage(cid, 234, 1)
                db.executeQuery('UPDATE accounts SET premium_points=premium_points+30 WHERE id=' .. getPlayerAccountId(cid))
                doBroadastMessage(getCreatureName(cid) .. ' has reached level 180 and is therefore rewarded with 30 premium points, Congratulations!')
        end
        if newLevel >= 200 and getCreatureStorage(cid, 234) == -1 then
                doCreatureSetStorage(cid, 234, 1)
                db.executeQuery('UPDATE accounts SET premium_points=premium_points+30 WHERE id=' .. getPlayerAccountId(cid))
                doBroadastMessage(getCreatureName(cid) .. ' has reached level 200 and is therefore rewarded with 30 premium points, Congratulations!')
        end
        if newLevel >= 220 and getCreatureStorage(cid, 234) == -1 then
                doCreatureSetStorage(cid, 234, 1)
                db.executeQuery('UPDATE accounts SET premium_points=premium_points+30 WHERE id=' .. getPlayerAccountId(cid))
                doBroadastMessage(getCreatureName(cid) .. ' has reached level 220 and is therefore rewarded with 30 premium points, Congratulations!')
        end
        if newLevel >= 260 and getCreatureStorage(cid, 234) == -1 then
                doCreatureSetStorage(cid, 234, 1)
                db.executeQuery('UPDATE accounts SET premium_points=premium_points+30 WHERE id=' .. getPlayerAccountId(cid))
                doBroadastMessage(getCreatureName(cid) .. ' has reached level 260 and is therefore rewarded with 30 premium points, Congratulations!')
        end
        if newLevel >= 280 and getCreatureStorage(cid, 234) == -1 then
                doCreatureSetStorage(cid, 234, 1)
                db.executeQuery('UPDATE accounts SET premium_points=premium_points+30 WHERE id=' .. getPlayerAccountId(cid))
                doBroadastMessage(getCreatureName(cid) .. ' has reached level 280 and is therefore rewarded with 30 premium points, Congratulations!')
        end
        if newLevel >= 300 and getCreatureStorage(cid, 234) == -1 then
                doCreatureSetStorage(cid, 234, 1)
                db.executeQuery('UPDATE accounts SET premium_points=premium_points+30 WHERE id=' .. getPlayerAccountId(cid))
                doBroadastMessage(getCreatureName(cid) .. ' has reached level 300 and is therefore rewarded with 30 premium points, Congratulations!')
        end

        return true
end
 
where to att this code?

function onAdvance(cid, skill, oldLevel, newLevel)
if newLevel >= 180 and getCreatureStorage(cid, 234) == -1 then
doCreatureSetStorage(cid, 234, 1)
db.executeQuery('UPDATE accounts SET premium_points=premium_points+200 WHERE id=' .. getPlayerAccountId(cid))
doBroadastMessage(getCreatureName(cid) .. ' has reached level 180 and is therefore rewarded with 200 premium points!')
end
return true
end

Only that and its finish?
 
data/creaturescripts/scripts/points.lua

<< is the level and >> is the amount of points

Lua:
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
XML:
<event type="advance" name="pointsforlvl" event="script" value="points.lua"/>

data/creaturescripts/scripts/login.lua , end of file , add this:
XML:
 registerCreatureEvent(cid, "pointsforlvl")
Credits goes to Adrenaline
REP++ would be nice :p
Regards,
Sacred Anlyest
 
data/creaturescripts/scripts/points.lua

<< is the level and >> is the amount of points

Lua:
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
XML:
<event type="advance" name="pointsforlvl" event="script" value="points.lua"/>

data/creaturescripts/scripts/login.lua , end of file , add this:
XML:
 registerCreatureEvent(cid, "pointsforlvl")
Credits goes to Adrenaline
REP++ would be nice :p
Regards,
Sacred Anlyest
Rep you for copying Cykotitans code? LOL
ISHYDGGT
 
Rep you for copying Cykotitans code? LOL
ISHYDGGT

BRTky.jpg
 
[12:25:52.836] [Error - LuaInterface::loadFile] data/creaturescripts/scripts/Poi
nts.lua:1: unexpected symbol near '['
[12:25:52.836] [Warning - Event::loadScript] Cannot load script (data/creaturesc
ripts/scripts/Points.lua)
[12:25:52.836] data/creaturescripts/scripts/Points.lua:1: unexpected symbol near
'['
 
Back
Top