What's new

Creaturescripts Points for Level - PKTY za LVL

DenZ

Zasłużony
Joined
Feb 23, 2011
Messages
860
Reaction score
29
Age
26
Code:
local config = {
	[100] = {pkt = 50, storage = 5254},
	[200] = {pkt = 50, storage = 5250},
	[300] = {pkt = 150, storage = 5251},
	[400] = {pkt = 200, storage = 5252},
	[500] = {pkt = 300, storage = 5253},
	[600] = {pkt = 450, storage = 5266}
}

function onAdvance(cid, skill, oldLevel, newLevel) 
	if skill == SKILL__LEVEL then
		for k, v in pairs(config) do
			if k == newLevel and getCreatureStorage(cid, v.storage) <= 0 then
				doCreatureSetStorage(cid, v.storage, 1)
			
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, 'Congratulations! You have reached level ' .. newLevel .. ', you have received ' .. v.pkt .. ' premium points.')
				db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. v.pkt .. " WHERE `id` = " .. getPlayerAccountId(cid))
				break
			end
		end
	end	
	return true
end
 
Top