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

Money on Advance

president vankk

Web Developer & AuraOT Owner
Joined
Jul 10, 2009
Messages
5,719
Solutions
9
Reaction score
339
i need one script the advance to level 45 and win 5cc.

Level: 45 wiin 5cc
Level: 100 wiin 10cc
Level: 150 wiin 35cc
Level: 200 wiin 50cc

Thx :)

my script (dont tested):
LUA:
function onAdvance(cid, skill, oldLevel, newLevel)
	local items = {
		[45] = {
			{2160, 5, 1777}
		},
		[100] = {
			{2160, 10, 1238}
		},
		[150] = {
			{2160, 35, 56534}
		},
		[200] = {
			{2160, 50, 5431}
	    }
	}
	local v = items[newLevel]
	return v and getPlayerStorageValue(cid, v[3]) == -1 and doPlayerAddItem(cid, v[1], v[2] or 1) and setPlayerStorageValue(cid, v[3], 1)
end
 
but you need a script or do you want to simply test it?
Here this should work; I haven't tested your script:
Code:
local items = {
		[45] = {
			{2160, 5, 1777}
		},
		[100] = {
			{2160, 10, 1238}
		},
		[150] = {
			{2160, 35, 56534}
		},
		[200] = {
			{2160, 50, 5431}
	    }
	}
function onAdvance(cid, skill, oldLevel, newLevel)
	local v = items[newLevel]
	if newLevel == v then
		if getPlayerStorageValue(cid, v[3]) == -1 then
			doPlayerAddItem(cid, v[1], v[2])
			setPlayerStorageValue(cid, v[3], 1)
		end	
	end	
return true
end
 
This:
LUA:
local items = {
		[45] = {
			{2160, 5, 1777}
		},
		[100] = {
			{2160, 10, 1238}
		},
		[150] = {
			{2160, 35, 56534}
		},
		[200] = {
			{2160, 50, 5431}
	    }
	}
	local v = items[newLevel]
is not advisable for this type of script, because if a players advances from level 44 to level 46 (killing a high exp monster), he won't receive anything.
 
LUA:
local config =
{
	[45] = {2160, 5, 1570},
	[100] = {2160, 10, 1571},
	[150] = {2160, 35, 1572},
	[200] = {2160, 50, 1573}
}

function onAdvance(cid, skill, oldLevel, newLevel)

	if skill == SKILL__LEVEL then
		for k, v in pairs(config) do
			if newLevel >= k then
				if getPlayerStorageValue(cid, tonumber(v[3])) < 1 then
					doCreatureSetStorage(cid, tonumber(v[3]), 1)
					doPlayerAddItem(cid, tonumber(v[1]), tonumber(v[2]))
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You receive " .. tonumber(v[2]) .. " " .. getItemNameById(tonumber(v[1])) .. " for reaching the level " .. newLevel .. ".")
					doSendMagicEffect(getCreaturePosition(cid), CONST_ME_MAGIC_RED)
				end
			end
		end
	end
	return true
end

Oops, sorry for double post
 
Back
Top