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

Lua NPC Bug

delton

New Member
Joined
Jun 13, 2008
Messages
230
Reaction score
0
Location
Ijuí
Please fix it:

I need a example for make others NPC's...

Script:

Code:
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
function onThink()                                      npcHandler:onThink()                                    end
function creatureSayCallback(cid, type, msg)
	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
	--[[
	REMEMBER TO SET YOUR STORAGE AS YOURSTORAGE!
	]]--
	local storage = 8586756
	if(msgcontains(msg, 'garrafa') or msgcontains(msg, 'mission') or msgcontains(msg, 'soft boots') or msgcontains(msg, 'firewalker boots')) then
		if(getPlayerStorageValue(cid, storage) > 1) then
			npcHandler:say("Obrigado, agora vou ler a carta, quando sair a próxima versão do Thyrania me pergunte sobre ela dizendo: carta..", cid)
			setPlayerStorageValue(cid, storage, 1)
		elseif(getPlayerStorageValue(cid, 8586757) == 1) then
			npcHandler:say("Ah então você leu meu aviso... Estou contratando exploradores para achar minha garrafa em POH, se quiser saber mais diga: {mission}", cid)
			talkState[talkUser] = 1
		elseif(getPlayerStorageValue(cid, storage) == 2) then
			npcHandler:say("Sorry, you have already done my quest.", cid)
		end
	elseif(msgcontains(msg, 'mission') and talkState[talkUser] == 1) then
		if(getPlayerStorageValue(cid, storage) > 2) then
			npcHandler:say("Você já foi encantado e pegou a garrafa.", cid)
			setPlayerStorageValue(cid, storage, 1)
			talkState[talkUser] = 0
		else
				npcHandler:say('Você foi encantado e agora pode pegar a garrafa, va e me traga a garrafa para eu poder lhe dar uma recompensa e talvez lhe contratar para outra missão.', cid)
				setPlayerStorageValue(cid,storage, 1)
			talkState[talkUser] = 0
		end
	elseif(msgcontains(msg, 'no') and talkState[talkUser] > 0) then
		npcHandler:say("Then not.", cid)
		talkState[talkUser] = 0
					elseif msgcontains(msg, 'soft boots') then
			if getPlayerItemCount(cid,10021) >= 1 then
				selfsay('Você tem worn soft boots? ?', cid)
			talk_state = 1
			else
				npcHandler:say('I need worn soft boots.', cid)
			talk_state = 0
			end

		elseif msgcontains(msg, 'yes') and talk_state == 2) then
			if getPlayerItemCount(cid,10021) >= 1 then
			if doPlayerRemoveItem(cid,10021, 1) == TRUE then
							selfsay('Here you are', cid)
			doPlayerAddItem(cid, 2640, 1)
			end
			else
				npcHandler:say('Sorry you not have worn soft boots', cid)
			end
		elseif msgcontains(msg, 'firewalker boots') then
			if getPlayerItemCount(cid,9934) >= 1 then
			selfsay('Você tem worn firewalker boots?', cid)
			talk_state = 1
			else
			selfsay('Eu presciso de uma worn soft boots, volte quando você tiver uma.', cid)
			talk_state = 0
			end
		elseif msgcontains(msg, 'yes') and talk_state == 2) then
			if getPlayerItemCount(cid,9934) >= 1 then
			if doPlayerRemoveItem(cid,9934,1) == TRUE then
				selfsay('Here you are', cid)
			doPlayerAddItem(cid,9932,1)
			end
			else
			npcHandler:say('Sorry you not have requireds items', cid)
			end
	end
	return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Please Help x10000000

I will rep++
 

Similar threads

Back
Top