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

Lua Money reward on 45lvl

Strashni

minera.servegame.com
Joined
May 10, 2009
Messages
230
Reaction score
0
Location
Montenegro
Can someone fix this bugged script
Code:
function onAdvance(cid, skill, oldlevel, newlevel)
local config = {
levelReach = 45,
item = 2160,
count = 6
}
if(skill == SKILL__LEVEL and newlevel >= config.levelReach and getPlayerStorageValue(cid, 9899) ~= 1) then
setPlayerStorageValue(cid, 9899, 1)
doPlayerAddItem(cid, config.item, config.count)
end
return TRUE
end
 
Create new file in creaturescripts/scripts/ call it reward.
Lua:
function onAdvance(cid, skill, oldlevel, newlevel)
local cfg = {
	level = 45,
	item = 2160,
	count = 5,
	storage = 1234
}
	if(getPlayerStorageValue(cid, cfg.storage) ~= 1 and skill == SKILL__LEVEL and newlevel >= cfg.level) then
		doPlayerSendTextMessage(cid, 19, "You have recevied a reward because you reached level "..cfg.level..".")
		doPlayerSetStorageValue(cid, cfg.storage, 1)
		doPlayerAddItem(cid, cfg.item, cfg.count)
	end
	return true
end

in creaturescript.xml
Code:
	<event type="advance" name="reward" event="script" value="reward.lua"/>

in login.lua under registerCreatureEvent(cid, "PlayerKill") add
Lua:
		registerCreatureEvent(cid, "reward")

kkthxbye, not tested :)
 
Last edited:
zonet,script don't work :S..but thx for trying to help :p

Any error? What isn't working?
Anyway, I'm using this one and works, I hope you can configure it. [Without variables]
Lua:
function onAdvance(cid, skill, oldlevel, newlevel)
	
	if(getPlayerStorageValue(cid, 99963) ~= 1 and skill == SKILL__LEVEL and newlevel >= 45) then
		doPlayerAddItem(cid, 2160, 5)
		setPlayerStorageValue(cid, 99963, 1)
		doPlayerSendTextMessage(cid, 22, "You have received 5 crystal coin because you reached level 45")
		end
	return TRUE
end

And the other one, i forgot a "," at the count variable try it again :p.
 
Back
Top