• 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 at levels

krille09

Belden
Joined
Aug 15, 2007
Messages
4,894
Reaction score
55
Location
Stockholm, Sweden
I want a script that will give you money on diffrent level like lvl 20 and 50..

please

searched but did not find

something like this?
LUA:
if getPlayerLevel(cid) = 25 then	
	doPlayerAddMoney(cid, money)
	else
	doPlayerSendCancel(cid, "You need to be level 25 for this!")
end
 
In creaturescripts -> scripts add a file called: "Money.lua" and add this
LUA:
  function onAdvance(cid, skill, oldLevel, newLevel)
    if skill == SKILL__LEVEL and newLevel >= 50 and getPlayerStorageValue(cid, 2222) == -1 then
				doPlayerAddItem(cid, 2160, 5)
                doCreatureSay(cid, "You just got rich!", TALKTYPE_ORANGE_1)
				doSendMagicEffect(getCreaturePosition(cid), 14) 
				setPlayerStorageValue(cid, 2222, 1)
				
        end
        return true
end

And in creaturescripts.xml:
XML:
	<event type="advance" name="Money" event="script" value="money.lua"/>

Simple piece of code, in this case it will give 5 crystal coins when you're advancing to level 50.
I think you can configure it yourself =)
 
Last edited:
LUA:
function onUse(cid, item, frompos, item2, topos)
	local storage = 3221 --Storage value
	local status = getPlayerStorageValue(cid,storage)
	local m = getPlayerLevel(cid)
	local t = 25 --How much level
	local x = 100 --How much money
if status == -1 and m >= t then
 doPlayerAddMoney(cid, x)
 setPlayerStorageValue(cid,storage,1)
 doPlayerSendTextMessage(cid,22,"You have found ".. x .." money.") 
 else
 doPlayerSendTextMessage(cid,22,"You need to be ".. t .." level to get ".. x .." money!")
 end
return 1
end
Rep+

EDIT:
onAdvance script
LUA:
function onAdvance(cid, skill, oldLevel, newLevel)
	local storage = 3221 --Storage value
	local status = getPlayerStorageValue(cid,storage)
	local m = getPlayerLevel(cid)
	local t = 25 --How much level
	local x = 100 --How much money
if status == -1 and m >= t then
 doPlayerAddMoney(cid, x)
 setPlayerStorageValue(cid,storage,1)
 doPlayerSendTextMessage(cid,22,"You have got ".. x .." money for getting level ".. t ..".") 
 end
return 1
end
 
That is if you use a chest. Didn't he mean you will get the money automatically when you level up?
I don't know, I might be wrong.
 
Improved code to add multiple levels in 1 script with different rewards:

Make a file called "levelreward.lua" in creaturescripts -> scripts and add this code in:
LUA:
  function onAdvance(cid, skill, oldLevel, newLevel)
  
  -- instructions:
  -- You can easily add more items on a certain level. As you see below, you can make as many rewards as you want.
  -- The storage value should be different all the time.
  -- The item is the ID of the item you want to give. In this example, it's 2160, which is a crystal coin.
  -- Count is the count of the item you want to give. Here it's 5 crystal coins, or 10 crystal coins.
  
  t = {
	[50] = {storage=2222, item=2160, count=5},
	[100] = {storage=2223, item=2160, count=10}   
  }
  
  local v = t[newLevel]
    if skill == SKILL__LEVEL and v == true and getPlayerStorageValue(cid, v.storage) == -1 then
				doPlayerAddItem(cid, v.item, v.count)
                doCreatureSay(cid, "Congratulations! You have received an item!", TALKTYPE_ORANGE_1)
				doSendMagicEffect(getCreaturePosition(cid), 14) 
				setPlayerStorageValue(cid, v.storage, 1)
				
        end
        return true
end

In creaturescripts.xml:
XML:
 	<event type="advance" name="levelreward" event="script" value="levelreward.lua"/>

In scripts -> login.lua:
LUA:
	registerCreatureEvent(cid, "levelreward")

Add that somewhere at the bottom, where the other registerCreatureEvents are.
I have added instructions to the script on how to add more items etc to make it more easy for you.

Kind regards,
Spoking
 
EDIT:
onAdvance script
Lua Code:
function onAdvance(cid, skill, oldLevel, newLevel) &nbsp;&nbsp;&nbsp;&nbsp;local storage = 3221 --Storage value &nbsp;&nbsp;&nbsp;&nbsp;local status = getPlayerStorageValue(cid,storage) &nbsp;&nbsp;&nbsp;&nbsp;local m = getPlayerLevel(cid) &nbsp;&nbsp;&nbsp;&nbsp;local t = 25 --How much level &nbsp;&nbsp;&nbsp;&nbsp;local x = 100 --How much money if status == -1 and m >= t then doPlayerAddMoney(cid, x) setPlayerStorageValue(cid,storage,1) doPlayerSendTextMessage(cid,22,"You have got ".. x .." money for getting level ".. t ..".")
end return 1 end
this only works :p
sad thing is that, i can only have for 1, so i have to make 2 money.lua instead of 1 :<
 
Last edited:
In creaturescripts -> scripts add a file called: "Money.lua" and add this
LUA:
  function onAdvance(cid, skill, oldLevel, newLevel)
    if skill == SKILL__LEVEL and newLevel >= 50 and getPlayerStorageValue(cid, 2222) == -1 then
				doPlayerAddItem(cid, 2160, 5)
                doCreatureSay(cid, "You just got rich!", TALKTYPE_ORANGE_1)
				doSendMagicEffect(getCreaturePosition(cid), 14) 
				setPlayerStorageValue(cid, 2222, 1)
				
        end
        return true
end

And in creaturescripts.xml:
XML:
	<event type="advance" name="Money" event="script" value="money.lua"/>

Simple piece of code, in this case it will give 5 crystal coins when you're advancing to level 50.
I think you can configure it yourself =)

this script does not work, i aint getting any cash at lvl 50
 
Please use the search function. There are many released.

Here is one that will add money to the player's bank account automatically.

Code:
function onAdvance(cid, skill, oldLevel, newLevel)
	local cfg = {
		[[COLOR="red"]STORAGE[/COLOR]] = {
			25, -- LEVEL
			5000 -- MONEY
		}
	}
	if skill == SKILL__LEVEL then
		for s, x in pairs(cfg) do
			if newLevel >= x[1] then
				if getPlayerStorageValue(cid, s) < 1 then
					doPlayerSetBalance(cid, getPlayerBalance(cid) + x[2])
					setPlayerStorageValue(cid, s, 1)
					doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Banker: Congratulations! You have obtained level " .. x[1] .. ". I have added new funds to your bank account.")
					break
				end
			end
		end
	end
	
	return true
end
 
Back
Top