Skocz do zawartości
  • 👋 Witaj na MPCForum!

    Przeglądasz forum jako gość, co oznacza, że wiele świetnych funkcji jest jeszcze przed Tobą! 😎

    • Pełny dostęp do działów i ukrytych treści
    • Możliwość pisania i odpowiadania w tematach
    • System prywatnych wiadomości
    • Zbieranie reputacji i rozwijanie swojego profilu
    • Członkostwo w jednej z największych społeczności graczy

    👉 Dołączenie zajmie Ci mniej niż minutę – a zyskasz znacznie więcej!

    Zarejestruj się teraz

NPC POSTMAN PROBLEM!


bartessssssssss

Rekomendowane odpowiedzi

Opublikowano

Witam, problem dotyczy npc A Strange Fellow, to chyba 3cia misja. Kiedy napisze do niego hi > hat wyskakuje mi takie cos.

 

414e2b43cc259.png

 

Skrypt npc

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
 
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 -- linijka 8
function onThink()					npcHandler:onThink()					end
function creatureSayCallback(cid, type, msg)
	if(not npcHandler:isFocused(cid)) then
		return false
	end

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

	if(getPlayerStorageValue(cid, 250) ~= 5) then
		return true
	end
	
	if(msgcontains(msg, "bill")) then
		if(talkState[talkUser] == 6) then
			npcHandler:say("A bill? Oh boy so you are delivering another bill to poor me? ", cid)
			talkState[talkUser] = 7
		end
	elseif(msgcontains(msg, "yes")) then
		if(talkState[talkUser] == 7) then
			npcHandler:say("Ok, ok, I'll take it. I guess I have no other choice anyways. And now leave me alone in my misery please. ", cid)
			talkState[talkUser] = 0
			setPlayerStorageValue(cid, 250, 6)
		end
	elseif(msgcontains(msg, "hat")) then
		if(talkState[talkUser] < 1) then -- linijka 33
			npcHandler:say("Uh? What do you want?! ", cid)
			talkState[talkUser] = 2
		elseif(talkState[talkUser] == 2) then
			npcHandler:say("What? My hat?? Theres... nothing special about it! ", cid)
			talkState[talkUser] = 3
		elseif(talkState[talkUser] == 3) then
			npcHandler:say("Stop bugging me about that hat, do you listen? ", cid)
			talkState[talkUser] = 4
		elseif(talkState[talkUser] == 4) then
			npcHandler:say("Hey! Don't touch that hat! Leave it alone!!! Don't do this!!!! ", cid)
			talkState[talkUser] = 5
		elseif(talkState[talkUser] == 5) then
			npcHandler:say("Noooooo! Argh, ok, ok, I guess I can't deny it anymore, I am David Brassacres, the magnificent, so what do you want? ", cid)
			talkState[talkUser] = 6
		end
	end
	return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

I tu kawalek ze skryptu npchandler

	-- Handles onCreatureSay events. If you with to handle this yourself, please use the CALLBACK_CREATURE_SAY callback.
	function NpcHandler:onCreatureSay(cid, class, msg)
		local callback = self:getCallback(CALLBACK_CREATURE_SAY)
		if(callback == nil or callback(cid, class, msg)) then
			if(self:processModuleCallback(CALLBACK_CREATURE_SAY, cid, class, msg)) then
				if(not self:isInRange(cid)) then
					return
				end

				if(self.keywordHandler ~= nil) then
					if((self:isFocused(cid) and (class == TALKTYPE_PRIVATE_PN or NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT)) or not self:isFocused(cid)) then
						local ret = self.keywordHandler:processMessage(cid, msg)
						if(not ret) then
							local callback = self:getCallback(CALLBACK_MESSAGE_DEFAULT)
							if(callback ~= nil and callback(cid, class, msg)) then -- linijka 383
								if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then
									self.talkStart[cid] = os.time()
								else
									self.talkStart = os.time()
								end
							end
						else
							if(NPCHANDLER_CONVBEHAVIOR ~= CONVERSATION_DEFAULT) then
								self.talkStart[cid] = os.time()
							else
								self.talkStart = os.time()
							end
						end
					end
				end
			end
		end
	end

W linku caly kod npchandler

 

https://code.google.com/p/wedoserver/source/browse/trunk/data/npc/lib/npcsystem/npchandler.lua?r=107 

 

Mógłby ktos mi pomoc?

Kocham mpcforum.pl!!!

18706.png

Zarchiwizowany

Ten temat przebywa obecnie w archiwum. Dodawanie nowych odpowiedzi zostało zablokowane.

×
×
  • Dodaj nową pozycję...