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

Solved NPC Level

Ghazer

Member
Joined
Mar 13, 2009
Messages
350
Reaction score
6
I want NPC if you are lower than 120 you can buy up to level 130 for 1kk, its possible? help please
 
LUA:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid)				npcHandler:onCreatureAppear(cid) 			end
function onCreatureDisappear(cid) 			npcHandler:onCreatureDisappear(cid) 		end
function onCreatureSay(cid, type, msg) 		npcHandler:onCreatureSay(cid, type, msg) 	end
function onThink() 							npcHandler:onThink() 						end
function onPlayerEndTrade(cid)				npcHandler:onPlayerEndTrade(cid)			end
function onPlayerCloseChannel(cid)			npcHandler:onPlayerCloseChannel(cid)		end

local talk = {}
local config = {
	storage = 130030,
	level = 130
}
function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end

	talk[cid] = talk[cid] or 0
	
	if msgcontains(msg, "level") and talk[cid] == 0 then
		if getPlayerLevel(cid) >= 130 then
			selfSay("Sorry, but you can only use this below level 120..", cid)
			return true
		end
		
		if getPlayerStorageValue(cid, config.storage) >= 1 then
			selfSay("You already used this service", cid)
			return true
		end
		
		selfSay("Do you want to level up to 130 for 1kk gold?", cid)
		talk[cid] = 1
	elseif talk[cid] == 1 then
		if msgcontains(msg, 'yes') then
			if not(doPlayerRemoveMoney(cid, 1000000)) then
				selfSay("You need to pay 1kk..", cid)
				talk[cid] = 0
				return true
			end
			selfSay('Here you are.. level 130!', cid)
			setPlayerStorageValue(cid, config.storage, 1)
			
			local expNeeded = getExperienceForLevel(config.level) - getPlayerExperience(cid)
			if expNeeded > 0 then
				doPlayerAddExperience(cid, expNeeded)
				doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_GREEN)
			end
		else
			selfSay("maybe later..", cid)
		end
		talk[cid] = 0
	end

	return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top