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

Need one npc

You don't need any parameters in the XML file. Enjoy!



Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

local Topic = {}

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 greetCallback(cid)
	Topic[cid] = 1
	return true
end

function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	elseif Topic[cid] == 1 and msgcontains(msg, 'yes') then
		npcHandler:releaseFocus(cid)
		doRemoveCreature(cid)
	else
		npcHandler:say('Well, it seems you do not need my expertise, good bye.', cid)
		npcHandler:releaseFocus(cid)
	end
	
	Topic[cid] = nil
	return true
end

npcHandler:setMessage(MESSAGE_GREET, 'Hello, |PLAYERNAME|! I have the power to kick any player! Would you like to be kicked?')
npcHandler:setMessage(MESSAGE_FAREWELL, 'Have a wonderful day.')
npcHandler:setMessage(MESSAGE_WALKAWAY, 'Okay well, bye.')
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

You should add some restrictions or its going to get abused.
 
Back
Top