Ir para conteúdo

Featured Replies

Postado

Bom, começou a aparecer esse erro novamente com o NPCHANDLER, 
Poderia me orientar onde esta o erro para localizar o problema amigão??

KRAZUK.LUA
http://pastebin.com/E03JYxg8
 

NPCHANDLER.LUA
http://pastebin.com/viQrwUap

 

ERRO

 

Lua Script Error: [Npc interface] 
data/npc/scripts/Emperor Kruzak.lua:onCreatureSay 
data/npc/scripts/Emperor Kruzak.lua:19: attempt to index global 'Topic' (a nil value) 
stack traceback: 
[C]: in function '__newindex' 
data/npc/scripts/Emperor Kruzak.lua:19: in function 'callback' 
data/npc/lib/npcsystem/npchandler.lua:410: in function 'onCreatureSay' 
data/npc/scripts/Emperor Kruzak.lua:8: in function 
 

  • 2 weeks later...
Postado
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)


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 talkState, talkUser = {}, NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
	if msgcontains(msg, "promot") then
		npcHandler:say("Do you want to be promoted in your vocation for 20000 gold?", cid)
		talkState[talkUser] = 1
	elseif msgcontains(msg, "yes") and talkState[talkUser] == 1 then
		if(getPlayerStorageValue(cid, 30018) == 1) then
			npcHandler:say('You are already promoted.', cid)
		elseif(getPlayerLevel(cid) < 20) then
			npcHandler:say('You need to be at least level 20 in order to be promoted.', cid)
		elseif getPlayerMoney(cid) < 20000 then
			npcHandler:say('You do not have enough money.', cid)
		elseif getConfigInfo("freePremium") == "yes" or isPremium(cid) == TRUE then
			npcHandler:say("Congratulations! You are now promoted. You have learned new spells.", cid)
			local promotedVoc = getPromotedVocation(getPlayerVocation(cid))
			doPlayerSetVocation(cid, promotedVoc)
			doPlayerRemoveMoney(cid, 20000)
		else
			npcHandler:say("You need a premium account in order to promote.", cid)
		end
		talkState[talkUser] = 0
	end
	return true
end

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

 

Editado por fireelement (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.6k

Informação Importante

Confirmação de Termo