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

Little npc help!

d4rkbl0od

Member
Joined
Mar 21, 2008
Messages
160
Reaction score
7
Hello folks, can someone help me with this script??

-- What it do?
look:


1. Real names both times: getPlayerName(cid)


Player: hi
Buddel: Hey big guys. *HICKS*
Player: name
Buddel: There was a time I was called Bejorn. But everyone calls me Buddel. ..... and you are?
Player: Player
Buddel: Ahh, Player. And you?
Player: Player
Buddel: You are also called Player?!?!? Your mother was not very inventive *HICKS* but very convenient. ...
Buddel: She only needs to remember one name and when she calls one of you, both of you will come!!!





Ok, here is the problem (Any names) how can I do a (msgcontains(msg, '......???')
2. Any names:



Player: name
Buddel: There was a time I was called Bejorn. But everyone calls me Buddel. ..... and you are?
Player: any name or anything
Buddel: Aha! And you?
Player: any name or anything
Buddel: Huhuhu,..... er..... shouldn't be offensive, but this is a funny name you have!




3. Real name as first, any name as second (or any name first then real name:

Player: name
Buddel: There was a time I was called Bejorn. But everyone calls me Buddel. ..... and you are?
Player: Player
Buddel: Ahh, Player. And you?
Player: any name
Buddel: Huhuhu,..... er..... shouldn't be offensive, but this is a funny name you have!


I dont know what to make :S please help me!
 
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 creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	elseif msgcontains(msg, 'name') then
		selfSay('There was a time I was called Bejorn. But everyone calls me Buddel. ..... and you are?', cid)
		Topic[cid] = 1
	elseif Topic[cid] == 1 then
		if msg:lower() == getCreatureName(cid):lower() then
			selfSay('Ahh, ' .. getCreatureName(cid) .. '. And you?', cid)
		else
			selfSay('Aha! And you?', cid)
		end
		Topic[cid] = 2
	elseif Topic[cid] == 2 then
		if msg:lower() == getCreatureName(cid):lower() then
			selfSay('You are also called ' .. getCreatureName(cid) .. '?!?!? Your mother was not very inventive *HICKS* but very convenient. ...', cid)
			selfSay('She only needs to remember one name and when she calls one of you, both of you will come!!!', cid)
		else
			selfSay('Huhuhu,..... er..... shouldn\'t be offensive, but this is a funny name you have!', cid)
		end
		Topic[cid] = 0
	end

	return true
end

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