Ir para conteúdo

Featured Replies

  • Respostas 8
  • Visualizações 634
  • Created
  • Última resposta

Top Posters In This Topic

Postado

Cara eu reescrevi o script de outra forma, nao tenho como testar ele porque estou fazendo td no meu serviço...

testa ae e ve se funciona, se funcionar bom, se nao funcionar avisa que arrumo os erros... pelo teste de mesa rapido que fiz antes do chefe chegar o script irá rodar tranquilo!!

 

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)
	if(not npcHandler:isFocused(cid)) then
		return false
	end

	local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

	if(msgcontains(msg, 'trade') or msgcontains(msg, 'changer')) then
		selfSay('Voce pode trocar seus tokens por: boots of haste, Demon Helmet, Frozen Starlight, Spellbook of Dark Mysteries, Royal Crossbow!', cid)
		talkState[talkUser] = 1
	elseif(talkState[talkUser] == 1) then
		if(msgcontains(msg, 'boots of haste')) then
			selfSay('Boots of Haste custa 10 tokens, aceita trocar??', cid)
			if(msgcontains(msg, 'yes')) then		
				if(doPlayerRemoveItem(cid, 5468, 10)) then
					doPlayerAddItem(cid, 2195, 1)
					selfSay('Here you are.', cid)
				else
					selfSay('Sorry, you don\'t have enough tokens.', cid)
				end
			elseif(msgcontains(msg, 'no'))
				selfSay('Okay then.', cid)
			end
		elseif(msgcontains(msg, 'demon helmet')) then
			selfSay('Demon Helmet custa 10 tokens, aceita trocar??', cid)
			if(msgcontains(msg, 'yes')) then		
				if(doPlayerRemoveItem(cid, 5468, 10)) then
					doPlayerAddItem(cid, 2493, 1)
					selfSay('Here you are.', cid)
				else
					selfSay('Sorry, you don\'t have enough tokens.', cid)
				end
			elseif(msgcontains(msg, 'no'))
				selfSay('Okay then.', cid)
			end
		elseif(msgcontains(msg, 'frozen starlight')) then
			selfSay('Frozen Starlight custa 10 tokens, aceita trocar??', cid)
			if(msgcontains(msg, 'yes')) then		
				if(doPlayerRemoveItem(cid, 5468, 10)) then
					doPlayerAddItem(cid, 2361, 1)
					selfSay('Here you are.', cid)
				else
					selfSay('Sorry, you don\'t have enough tokens.', cid)
				end
			elseif(msgcontains(msg, 'no'))
				selfSay('Okay then.', cid)
			end
		elseif(msgcontains('spellbook of dark mysteries', cid)) then
			selfSay('Spellbook of Dark Mysteries custa 10 tokens, aceita trocar??', cid)
			if(msgcontains(msg, 'yes') then		
				if(doPlayerRemoveItem(cid, 5468, 10)) then
					doPlayerAddItem(cid, 8918, 1)
					selfSay('Here you are.', cid)
				else
					selfSay('Sorry, you don\'t have enough tokens.', cid)
				end
			elseif(msgcontains(msg, 'no'))
				selfSay('Okay then.', cid)
			end
		elseif(msgcontains(msg, 'royal crossbow')) then
			selfSay('Royal Rrossbow custa 10 tokens, aceita trocar??', cid)
			if(msgcontains(msg, 'yes')) then		
				if(doPlayerRemoveItem(cid, 5468, 10)) then
					doPlayerAddItem(cid, 8918, 1)
					selfSay('Here you are.', cid)
				else
					selfSay('Sorry, you don\'t have enough tokens.', cid)
				end
			elseif(msgcontains(msg, 'no'))
				selfSay('Okay then.', cid)
			end
		else
			selfSay('Sorry, you don\'t have the tokens.', cid)
		end
		talkState[talkUser] = 0
	elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser])) then
		talkState[talkUser] = 0
		selfSay('Ok then.', cid)
	end

	return true
end

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

Editado por Carinhah (veja o histórico de edições)

Postado
  • Autor

Puxa vida, ele não tá respondendo o hi ainda...

 

 
[13:35:41.695] [Error - NpcScript Interface]
[13:35:41.695] (Unknown script file)
[13:35:41.695] Description:
[13:35:41.695] attempt to call a nil value
[13:35:41.695] stack traceback:
 
 
Que hora tu chega do trab? Precisando resolver isso logo =\

Editado por lucas502 (veja o histórico de edições)

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo