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

when ur on a level [U receive Shop points] HELP [repp+]

Axelor

Member
Joined
Sep 2, 2010
Messages
505
Reaction score
9
Hiho,

how to make it so when somone reachs level 160 he receive automatic 30 shop points??

I like to have it for those levels

160lvl - 30ptz to sms shop

190lvl - 30ptz to sms shop

220lvl - 30ptz to sms shop

250lvl - 30ptz to sms shop

280lvl - 30ptz to sms shop

300lvl - 30ptz to sms shop

315lvl - 30ptz to sms shop

330lvl - 30ptz to sms shop


some1 have a script for this?

repp+
 
Credits: Unass

Add this at the end of functions.lua in libs
Lua:
function doAddPoints(cid, points)
db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. points .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
end
points.lua
Lua:
--Script By Unass--
local skills =
{
[1] = {points = 30, storage = 30701, value = 2, text = "level", level = 160},
[2] = {points = 30, storage = 30702, value = 2, text = "level", level = 190},
[3] = {points = 30, storage = 30703, value = 2, text = "level", level = 220},
[4] = {points = 30, storage = 30704, value = 2, text = "level", level = 250},
[5] = {points = 30, storage = 30705, value = 2, text = "level", level = 280},
[6] = {points = 30, storage = 30706, value = 2, text = "level", level = 300},
[7] = {points = 30, storage = 30707, value = 2, text = "level", level = 315},
[8] = {points = 30, storage = 30708, value = 2, text = "level", level = 330}
}
function onAdvance(cid, skill, oldLevel, newLevel)
local x = skills[skill]
if getGlobalStorageValue(x.storage) < x.value and getPlayerStorageValue(cid, x.storage) ~= x.value and getPlayerSkillLevel(cid, skill) >= x.level and skills[skill] then
doAddPoints(cid, x.points)
setGlobalStorageValue(x.storage, x.value)
setPlayerStorageValue(cid, x.storage, x.value)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Congratulations! You have Advanced to ".. x.level .." ".. x.text .." and you have earned ".. x.points .." Premium Points!")
end
return true
end

Lua:
<event type="advance" name="pointsforlvl" event="script" value="points.lua"/>

Lua:
registerCreatureEvent(cid, "pointsforlvl")
 
Lua:
local t, storage = {
	{160, 30},
	{190, 30},
	{220, 30},
	{250, 30},
	{280, 30},
	{300, 30},
	{315, 30},
	{330, 30}
}, 256

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 getStorage(storage) < i then
			db.executeQuery('UPDATE accounts SET premium_points=premium_points+'.. v[2] ..' WHERE id=' .. getPlayerAccountId(cid))
			doSetStorage(storage, i)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Congratulations! You have advanced to level ' .. v[1] .. ' and you have earned '.. v[2] ..' Premium Points!')
			break
		end
	end
	return true
end
Only the players who get these levels first will get the points, also make sure you have saveGlobalStorage = true in config.lua.
 
Last edited:
Lua:
local t, storage = {
	{160, 30},
	{190, 30},
	{220, 30},
	{250, 30},
	{280, 30},
	{300, 30},
	{315, 30},
	{330, 30}
}, 256

function onAdvance(cid, skill, oldLevel, newLevel)
	for i = 1, #t do
		local v = t[i]
		if newLevel >= v[1] and getStorage(storage) < i then
			db.executeQuery('UPDATE accounts SET premium_points=premium_points+'.. v[2] ..' WHERE id=' .. getPlayerAccountId(cid))
			doSetStorage(storage, i)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Congratulations! You have advanced to level ' .. v[1] .. ' and you have earned '.. v[2] ..' Premium Points!')
			break
		end
	end
	return true
end
Only the players who get these levels first will get the points, also make sure you have saveGlobalStorage = true in config.lua.



where do i have to add this?
at globalevents?
or actions?
creaturescript?

and also what to paste in creaturescript.xml or movements.xml or actions.xml or globalevents.xml,
dont know which it is,

repp+
 
Lua:
local t, storage = {
	{160, 30},
	{190, 30},
	{220, 30},
	{250, 30},
	{280, 30},
	{300, 30},
	{315, 30},
	{330, 30}
}, 256

function onAdvance(cid, skill, oldLevel, newLevel)
	for i = 1, #t do
		local v = t[i]
		if newLevel >= v[1] and getStorage(storage) < i then
			db.executeQuery('UPDATE accounts SET premium_points=premium_points+'.. v[2] ..' WHERE id=' .. getPlayerAccountId(cid))
			doSetStorage(storage, i)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Congratulations! You have advanced to level ' .. v[1] .. ' and you have earned '.. v[2] ..' Premium Points!')
			break
		end
	end
	return true
end
Only the players who get these levels first will get the points, also make sure you have saveGlobalStorage = true in config.lua.



also how to have it, so when a player reach up those levels. than there comes a server broadcast like
19:45 Congratulations! <playername> advenced to 190lvl and got 30 ptz to sms shop.
 
Lua:
doBroadcastMessage('Congratulations! ' .. getCreatureName(cid) .. ' advenced to ' .. v[1] .. 'lvl and got ' .. v[2] .. ' ptz to sms shop.')
 
Lua:
doBroadcastMessage('Congratulations! ' .. getCreatureName(cid) .. ' advenced to ' .. v[1] .. 'lvl and got ' .. v[2] .. ' ptz to sms shop.')



where do I have to put that in this

PHP:
local t, storage = {
	{160, 30},
	{190, 30},
	{220, 30},
	{250, 30},
	{280, 30},
	{300, 30},
	{315, 30},
	{330, 30}
}, 256
 
function onAdvance(cid, skill, oldLevel, newLevel)
	for i = 1, #t do
		local v = t[i]
		if newLevel >= v[1] and getStorage(storage) < i then
			db.executeQuery('UPDATE accounts SET premium_points=premium_points+'.. v[2] ..' WHERE id=' .. getPlayerAccountId(cid))
			doSetStorage(storage, i)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Congratulations! You have advanced to level ' .. v[1] .. ' and you have earned '.. v[2] ..' Premium Points!')
			break
		end
	end
	return true
end
 
derp..
Lua:
local t, storage = {
	{160, 30},
	{190, 30},
	{220, 30},
	{250, 30},
	{280, 30},
	{300, 30},
	{315, 30},
	{330, 30}
}, 256

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 getStorage(storage) < i then
			db.executeQuery('UPDATE accounts SET premium_points=premium_points+'.. v[2] ..' WHERE id=' .. getPlayerAccountId(cid))
			doSetStorage(storage, i)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Congratulations! You have advanced to level ' .. v[1] .. ' and you have earned '.. v[2] ..' Premium Points!')
			doBroadcastMessage('Congratulations! ' .. getCreatureName(cid) .. ' advenced to ' .. v[1] .. 'lvl and got ' .. v[2] .. ' ptz to sms shop.')
			break
		end
	end
	return true
end
 
derp..
Lua:
local t, storage = {
	{160, 30},
	{190, 30},
	{220, 30},
	{250, 30},
	{280, 30},
	{300, 30},
	{315, 30},
	{330, 30}
}, 256

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 getStorage(storage) < i then
			db.executeQuery('UPDATE accounts SET premium_points=premium_points+'.. v[2] ..' WHERE id=' .. getPlayerAccountId(cid))
			doSetStorage(storage, i)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Congratulations! You have advanced to level ' .. v[1] .. ' and you have earned '.. v[2] ..' Premium Points!')
			doBroadcastMessage('Congratulations! ' .. getCreatureName(cid) .. ' advenced to ' .. v[1] .. 'lvl and got ' .. v[2] .. ' ptz to sms shop.')
			break
		end
	end
	return true
end


yo,

I tested it out on my server, and I used this

for the points.lua
PHP:
local t, storage = {
	{160, 30},
	{190, 30},
	{220, 30},
	{250, 30},
	{280, 30},
	{300, 30},
	{315, 30},
	{330, 30}
}, 256
 
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 getStorage(storage) < i then
			db.executeQuery('UPDATE accounts SET premium_points=premium_points+'.. v[2] ..' WHERE id=' .. getPlayerAccountId(cid))
			doSetStorage(storage, i)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'Congratulations! You have advanced to level ' .. v[1] .. ' and you have earned '.. v[2] ..' Premium Points!')
			doBroadcastMessage('Congratulations! ' .. getCreatureName(cid) .. ' advenced to ' .. v[1] .. 'lvl and got ' .. v[2] .. ' ptz to sms shop.')
			break
		end
	end
	return true
end

and this on creaturescript.xml

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

And I didnt receive any points or did get any message, or broadcast...
whats wrong???
 
did you add registerCreatureEvent(cid, 'pointsforlvl') in login.lua?

added right now,
and used /reload creaturescript, it didnt work.

and than I restart server, still not working

login.lua

PHP:
local config = {
	loginMessage = getConfigValue('loginMessage'),
	useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)
	local loss = getConfigValue('deathLostPercent')
	if(loss ~= nil) then
		doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
	end

	local accountManager = getPlayerAccountManager(cid)
	if(accountManager == MANAGER_NONE) then
		local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
		if(lastLogin > 0) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
			str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
		else
			str = str .. " Please choose your outfit."
			doPlayerSendOutfitWindow(cid)
		end

		doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
	elseif(accountManager == MANAGER_NAMELOCK) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
	elseif(accountManager == MANAGER_ACCOUNT) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
	end

	if(not isPlayerGhost(cid)) then
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
	end

	registerCreatureEvent(cid, "Mail")
	registerCreatureEvent(cid, "GuildMotd")

	registerCreatureEvent(cid, "Idle")
	if(config.useFragHandler) then
		registerCreatureEvent(cid, "SkullCheck")
	end
	registerCreatureEvent(cid, "inquisitionPortals")
	registerCreatureEvent(cid, "ReportBug")
registerCreatureEvent(cid, 'pointsforlvl')   
   registerCreatureEvent(cid, "no-exp")
       registerCreatureEvent(cid, "aol")
       registerCreatureEvent(cid, "charge amulet")
      registerCreatureEvent(cid, "AdvanceSave")
       registerCreatureEvent(cid,'lvlup')
	registerCreatureEvent(cid, "ArenaKill")
	registerCreatureEvent(cid, "reward")
       registerCreatureEvent(cid, "reward120")
	registerCreatureEvent(cid, "PythiusTheRotten")
	
    -- if he did not make full arena 1 he must start from zero
    if getPlayerStorageValue(cid, 42309) < 1 then
        for i = 42300, 42309 do
            setPlayerStorageValue(cid, i, 0)
        end
    end
    -- if he did not make full arena 2 he must start from zero
    if getPlayerStorageValue(cid, 42319) < 1 then
        for i = 42310, 42319 do
            setPlayerStorageValue(cid, i, 0)
        end
    end
    -- if he did not make full arena 3 he must start from zero
    if getPlayerStorageValue(cid, 42329) < 1 then
        for i = 42320, 42329 do
            setPlayerStorageValue(cid, i, 0)
        end
    end
    if getPlayerStorageValue(cid, 42355) == -1 then
        setPlayerStorageValue(cid, 42355, 0) -- did not arena level
    end
    setPlayerStorageValue(cid, 42350, 0) -- time to kick 0
    setPlayerStorageValue(cid, 42352, 0) -- is not in arena  
	return true
end
 
w8w8, there is one problem.

now there is very big laggs after I received points at level 160,
I dont see any errors on console, whats the problem? :S
 
nobody?
it worked for the first time,
but all other players dont receive :S
Only the players who get these levels first will get the points
:p you should've told me to make it otherwise.
Lua:
local t, storage = {
	{160, 30},
	{190, 30},
	{220, 30},
	{250, 30},
	{280, 30},
	{300, 30},
	{315, 30},
	{330, 30}
}, 256
 
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_CONSOLE_ORANGE, 'Congratulations! You have advanced to level ' .. v[1] .. ' and you have earned '.. v[2] ..' Premium Points!')
		end
	end
	return true
end
 
Back
Top