Ir para conteúdo

Featured Replies

Postado
  • Autor
local money = xxxx -- Quanto vai custar
local storage = 14542 -- Não mexer

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

local function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say('you have already received the promotion', cid)
		return true
	end

	if msgcontains(msg:lower(), 'promotion') then
		npcHandler:say('you are sure?', cid)
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower(), 'yes') and npcHandler.topic[cid] == 1 then
		if isInArray({5, 6, 7, 8}, player:getVocation()) then	
			if player:getVipDays() >= 1 then
	        	if player:removeMoney(money) then
	        		npcHandler:say('you just received a new promotion', cid)
	        		player:setVocation(player:getVocation() + 4)
	        		player:setStorageValue(storage, 1)
	        		npcHandler.topic[cid] = 0
	        	else
	        		npcHandler:say('you no have money', cid)
	        		npcHandler.topic[cid] = 0
	        	end
	        else
	        	npcHandler:say('You do not have any vip days.', cid)
	        	npcHandler.topic[cid] = 0
	        end
	    else
	    	npcHandler:say('you no have first promotion', cid)
	    	npcHandler.topic[cid] = 0
	    end
    elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then
    	NpcHandler:say('Bye!!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

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

Aeee esse nao deu erro \o vou testar, e ja aviso aqui se deu certo!

local money = xxxx -- Quanto vai custar
local storage = 14542 -- Não mexer

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

local function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say('you have already received the promotion', cid)
		return true
	end

	if msgcontains(msg:lower(), 'promotion') then
		npcHandler:say('you are sure?', cid)
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower(), 'yes') and npcHandler.topic[cid] == 1 then
		if isInArray({5, 6, 7, 8}, player:getVocation()) then	
			if player:getVipDays() >= 1 then
	        	if player:removeMoney(money) then
	        		npcHandler:say('you just received a new promotion', cid)
	        		player:setVocation(player:getVocation() + 4)
	        		player:setStorageValue(storage, 1)
	        		npcHandler.topic[cid] = 0
	        	else
	        		npcHandler:say('you no have money', cid)
	        		npcHandler.topic[cid] = 0
	        	end
	        else
	        	npcHandler:say('You do not have any vip days.', cid)
	        	npcHandler.topic[cid] = 0
	        end
	    else
	    	npcHandler:say('you no have first promotion', cid)
	    	npcHandler.topic[cid] = 0
	    end
    elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then
    	NpcHandler:say('Bye!!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

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

Cara funcionou numa boa o npc, mas quando vou colocar a segunda promotion ela responde assim

13:42 Queen Alice: you no have first promotion

ps: já ta com a primeira promotion

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

1545517_5.png

  • Respostas 42
  • Visualizações 2.8k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • local money = xxxx -- Quanto vai custar local storage = 14542 -- Não mexer local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcH

  • local money = xxxx -- Quanto vai custar local storage = 14542 -- Não mexer local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcH

  • Tenta isso: local money = xxxx -- Quanto vai custar local storage = 14542 -- Não mexer local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parse

Postado

Tente :

local money = xxxx -- Quanto vai custar
local storage = 14542 -- Não mexer

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

local function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say('you have already received the promotion', cid)
		return true
	end

	if msgcontains(msg:lower(), 'promotion') then
		npcHandler:say('you are sure?', cid)
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower(), 'yes') and npcHandler.topic[cid] == 1 then
		for x = 5, 8 do	
			if player:getVocation() == x then
				break
				if player:getVipDays() >= 1 then
		        	if player:removeMoney(money) then
		        		npcHandler:say('you just received a new promotion', cid)
		        		player:setVocation(player:getVocation() + 4)
		        		player:setStorageValue(storage, 1)
		        		npcHandler.topic[cid] = 0
		        	else
		        		npcHandler:say('you no have money', cid)
		        		npcHandler.topic[cid] = 0
		        	end
		        else
		        	npcHandler:say('You do not have any vip days.', cid)
		        	npcHandler.topic[cid] = 0
		        end
		    else
		    	npcHandler:say('you no have first promotion', cid)
		    	npcHandler.topic[cid] = 0
		    end
		end
    elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then
    	NpcHandler:say('Bye!!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

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

#editado

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

EQD4Qy4.gif

Postado
  • Autor

Tente :

local money = xxxx -- Quanto vai custar
local storage = 14542 -- Não mexer

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

local function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say('you have already received the promotion', cid)
		return true
	end

	if msgcontains(msg:lower(), 'promotion') then
		npcHandler:say('you are sure?', cid)
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower(), 'yes') and npcHandler.topic[cid] == 1 then
		for x = 5, 8 do	
			if player:getVocation() == x then
				break
				if player:getVipDays() >= 1 then
		        	if player:removeMoney(money) then
		        		npcHandler:say('you just received a new promotion', cid)
		        		player:setVocation(player:getVocation() + 4)
		        		player:setStorageValue(storage, 1)
		        		npcHandler.topic[cid] = 0
		        	else
		        		npcHandler:say('you no have money', cid)
		        		npcHandler.topic[cid] = 0
		        	end
		        else
		        	npcHandler:say('You do not have any vip days.', cid)
		        	npcHandler.topic[cid] = 0
		        end
		    else
		    	npcHandler:say('you no have first promotion', cid)
		    	npcHandler.topic[cid] = 0
		    end
		end
    elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then
    	NpcHandler:say('Bye!!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

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

#editado

deu a mesma coisa

13:42 Queen Alice: you no have first promotion

ps: já ta com a primeira promotion

1545517_5.png

Postado

:hum:

local money = xxxx -- Quanto vai custar
local storage = 14542 -- Não mexer

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

local function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say('you have already received the promotion', cid)
		return true
	end

	if msgcontains(msg:lower(), 'promotion') then
		npcHandler:say('you are sure?', cid)
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower(), 'yes') and npcHandler.topic[cid] == 1 then
                print(player:getVocation)
		for x = 5, 8 do	
			if player:getVocation() == x then
				if player:getVipDays() >= 1 then
		        	if player:removeMoney(money) then
		        		npcHandler:say('you just received a new promotion', cid)
		        		player:setVocation(player:getVocation() + 4)
		        		player:setStorageValue(storage, 1)
		        		npcHandler.topic[cid] = 0
		        		break
		        	else
		        		npcHandler:say('you no have money', cid)
		        		npcHandler.topic[cid] = 0
		        	end
		        else
		        	npcHandler:say('You do not have any vip days.', cid)
		        	npcHandler.topic[cid] = 0
		        end
		    else
		    	npcHandler:say('you no have first promotion', cid)
		    	npcHandler.topic[cid] = 0
		    end
		end
    elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then
    	NpcHandler:say('Bye!!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

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

eu coloquei pra printar algo no console da uma olhada pra mim que numero aparece...

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

EQD4Qy4.gif

Postado
  • Autor

:hum:

local money = xxxx -- Quanto vai custar
local storage = 14542 -- Não mexer

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

local function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	end

	player = Player(cid)

	if player:getStorageValue(storage) == 1 then
		npcHandler:say('you have already received the promotion', cid)
		return true
	end

	if msgcontains(msg:lower(), 'promotion') then
		npcHandler:say('you are sure?', cid)
		npcHandler.topic[cid] = 1
	end

	if msgcontains(msg:lower(), 'yes') and npcHandler.topic[cid] == 1 then
                print(player:getVocation)
		for x = 5, 8 do	
			if player:getVocation() == x then
				if player:getVipDays() >= 1 then
		        	if player:removeMoney(money) then
		        		npcHandler:say('you just received a new promotion', cid)
		        		player:setVocation(player:getVocation() + 4)
		        		player:setStorageValue(storage, 1)
		        		npcHandler.topic[cid] = 0
		        		break
		        	else
		        		npcHandler:say('you no have money', cid)
		        		npcHandler.topic[cid] = 0
		        	end
		        else
		        	npcHandler:say('You do not have any vip days.', cid)
		        	npcHandler.topic[cid] = 0
		        end
		    else
		    	npcHandler:say('you no have first promotion', cid)
		    	npcHandler.topic[cid] = 0
		    end
		end
    elseif msgcontains(msg:lower(), 'no') and npcHandler.topic[cid] == 1 then
    	NpcHandler:say('Bye!!', cid)
    	npcHandler.topic[cid] = 0
    end

	return true
end

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

eu coloquei pra printar algo no console da uma olhada pra mim que numero aparece...

No console que vc fala eh no distro? se for nao aparece nada, e continua a mesma coisa >.<

 

1545517_5.png

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