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

On Advance

furstwin

New Member
Joined
Aug 9, 2007
Messages
486
Reaction score
1
Location
Sweden
I've tried to search but got no result, sorry if there's already existing threads.

I need 2 scripts, when a player advance to level 50 he get 50.000 gold pieces,
also when a player hit's 100,150,200,250,300,350,400 the player get one "shop point" per every fifty levels.

Regards,
Soder.
 
Lua:
local storage = 5

function onAdvance(cid, skill, oldLevel, newLevel)
	if skill == SKILL__LEVEL and newLevel % 50 == 0 and getCreatureStorage(cid, storage) < newLevel / 50 then
		db.executeQuery('UPDATE accounts SET premium_points=premium_points+1 WHERE id=' .. getPlayerAccountId(cid))
		doCreatureSetStorage(cid, storage, newLevel / 50)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You have received 1 premium point.')
		if newLevel == 50 then
			doPlayerAddMoney(cid, 50000)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You have received 50k for reaching Level 50.')
		end
	end
	return true
end
 
Lua:
local storage = 5

function onAdvance(cid, skill, oldLevel, newLevel)
	if skill == SKILL__LEVEL and newLevel % 50 == 0 and getCreatureStorage(cid, storage) < newLevel / 50 then
		db.executeQuery('UPDATE accounts SET premium_points=premium_points+1 WHERE id=' .. getPlayerAccountId(cid))
		doCreatureSetStorage(cid, storage, newLevel / 50)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You have received 1 premium point.')
		if newLevel == 50 then
			doPlayerAddMoney(cid, 50000)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You have received 50k for reaching Level 50.')
		end
	end
	return true
end

Can you post the creatureevent.xml part or what scipt that is :p? I'm not really good with that one :p
 
The easiest and best way would be to merge this script with a script you already have, advancesave.lua:
Lua:
local config = {
	savePlayersOnAdvance = true
}
local storage = 5

function onAdvance(cid, skill, oldLevel, newLevel)
	if(config.savePlayersOnAdvance) then
		doPlayerSave(cid, true)
	end

	if skill == SKILL__LEVEL and newLevel % 50 == 0 and getCreatureStorage(cid, storage) < newLevel / 50 then
		db.executeQuery('UPDATE accounts SET premium_points=premium_points+1 WHERE id=' .. getPlayerAccountId(cid))
		doCreatureSetStorage(cid, storage, newLevel / 50)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You have received 1 premium point.')
		if newLevel == 50 then
			doPlayerAddMoney(cid, 50000)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You have received 50k for reaching Level 50.')
		end
	end

	return true
end
 
The easiest and best way would be to merge this script with a script you already have, advancesave.lua:
Lua:
local config = {
	savePlayersOnAdvance = true
}
local storage = 5

function onAdvance(cid, skill, oldLevel, newLevel)
	if(config.savePlayersOnAdvance) then
		doPlayerSave(cid, true)
	end

	if skill == SKILL__LEVEL and newLevel % 50 == 0 and getCreatureStorage(cid, storage) < newLevel / 50 then
		db.executeQuery('UPDATE accounts SET premium_points=premium_points+1 WHERE id=' .. getPlayerAccountId(cid))
		doCreatureSetStorage(cid, storage, newLevel / 50)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You have received 1 premium point.')
		if newLevel == 50 then
			doPlayerAddMoney(cid, 50000)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You have received 50k for reaching Level 50.')
		end
	end

	return true
end

Thank you, after thinking abit, is it possible to make when you reach level 150, 200, 250 and so on only? As you need 5 points only for the solar axe, and it would be pretty easy to get 5x level 50 or 100 :p
Anyhow, "You must spread some Reputation around before giving it to Cykotitan again."
 
Lua:
local config = {
	savePlayersOnAdvance = true
}
local storage = 5

function onAdvance(cid, skill, oldLevel, newLevel)
	if(config.savePlayersOnAdvance) then
		doPlayerSave(cid, true)
	end

	if skill == SKILL__LEVEL and newLevel % 50 == 0 and getCreatureStorage(cid, storage) < newLevel / 50 then
		if newLevel == 50 then
			doPlayerAddMoney(cid, 50000)
			doCreatureSetStorage(cid, storage, newLevel / 50)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You have received 50k for reaching Level 50.')
		elseif newLevel >= 150 then
			db.executeQuery('UPDATE accounts SET premium_points=premium_points+1 WHERE id=' .. getPlayerAccountId(cid))
			doCreatureSetStorage(cid, storage, newLevel / 50)
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, 'You have received 1 premium point.')
		end
	end

	return true
end
 
Back
Top