xLosT
Member
need one npc, if player say hi kick player
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())