• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

CreatureEvent Points And Reward for Level

hugq

Member
Joined
Mar 17, 2010
Messages
166
Reaction score
9
Code:
local config = {
	[10] = {r = {2160, 1}},
	[20] = {p = 20},
	[30] = {p = 1, r = {2160, 3}},
	[40] = {p = 1},
	[50] = {p = 50, r = {2160, 5}},
	[60] = {p = 60, r = {2160, 6}},
	[70] = {p = 70, r = {2160, 7}},
	[80] = {p = 80, r = {2160, 8}}
}

function onAdvance(cid, skill, oldLevel, newLevel)
	if skill == SKILL__LEVEL then
		for level, v in pairs(config) do
			if newLevel >= level and getCreatureStorage(cid, 100 + level) < 0 then
				if v.p then
					db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. v.p .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
				end
				if v.r then
					doPlayerAddItem(cid, v.r[1], v.r[2] or 1)
				end
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You got" .. (v.p and " " .. v.p .. " point" or "") .. "" .. (v.p ~= nil and v.p > 1 and "s" or "") .. " " .. (v.p == nil and v.r and "reward " or "") .. "" .. (v.p ~= nil and v.r and "and reward " or "") .. "for advanced from Level " .. oldLevel .. " to Level " .. newLevel .. ".")
				doCreatureSetStorage(cid, 100 + level, 1)
			end
		end
	end
	doPlayerSave(cid, true) 
	return true
end
 
Last edited:
hmmm, nice but if u can make it some missions instead or killing amount of monsters
:D
Anyway nice script
 
How about that bug:
- If player reached level and gain points and he dead and lost level , and level up again he got 2x points ?
Huh ? o_O
 
There isn't this bug loot at this (Get storage):

Lua:
if newLevel >= level and getCreatureStorage(cid, 100 + level) < 0 then

And add storage:

Lua:
doCreatureSetStorage(cid, 100 + level, 1)

/ Potar
 

Similar threads

Back
Top Bottom