Ir para conteúdo
  • Cadastre-se

PEDIDO Segunda promotion VIP e NPC [TFS 1.0]


Posts Recomendados

Olhe agora pra ver que numero aparece no console ao falar yes... sim distro é console...

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())
			if player:getVocation() == 5 or player:getVocation() == 6 or player:getVocation() == 7 or player:getVocation() == 8 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())
Editado por Summ (veja o histórico de edições)

EQD4Qy4.gif

Link para o post
Compartilhar em outros sites
  • Respostas 42
  • Created
  • Última resposta

Top Posters In This Topic

Top Posters In This Topic

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(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 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

Tenta isso: 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:onTh

 

Olhe agora pra ver que numero aparece no console ao falar yes... sim distro é console...

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())
			if player:getVocation() == 5 or player:getVocation() == 6 or player:getVocation() == 7 or player:getVocation() == 8 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())

agora apareceu isto quando estava dando loading no server:

[Warning - NpcScript::NpcScript] Can not load script: Queen Alice.lua

data/npc/scripts/Queen Alice.lua:52: 'end' expected (to close 'function' at line 13) near 'elseif'

 

1545517_5.png

Link para o post
Compartilhar em outros sites

Eu já retirei esse end ... quando eu enviei, vi ele dps editei, quando eu postar olhe se eu não editei o tópico novamente pra corrigir/mudar algo.

Tenta dnv com o code acima.

EQD4Qy4.gif

Link para o post
Compartilhar em outros sites

Eu já retirei esse end ... quando eu enviei, vi ele dps editei, quando eu postar olhe se eu não editei o tópico novamente pra corrigir/mudar algo.

Tenta dnv com o code acima.

hehehe não tinha visto, apareceu esse código no distro quando fala "yes"

userdata: 0x7f02c8068b58

Conseguiu amigo? Estou no aguardo :D

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

1545517_5.png

Link para o post
Compartilhar em outros sites

Não testei:

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

	local 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 player:getPromotion() == 1 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())
Editado por Summ (veja o histórico de edições)

EQD4Qy4.gif

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    Nenhum usuário registrado visualizando esta página.

  • Conteúdo Similar

    • Por Raito
      Eu e mais 3 pessoas gostariamos de criar um digitibia alguem poderia me ajudar disponibilizando uma base que esteja funcionando, as unicas que eu encontrei nao funcionam. se alguem tiver para disponibilizar eu agradesço muito.
      meu email é 
      [email protected]
    • Por LasseXeterno
      Então, estou tentando adicionar uma nova "race" no meu Ot de base Cyan, tentei seguir 3 tutoriais aqui do tibiaking, um sobre race, porém nos códigos do meu servidor não tem o constant.h e nem o monster.cpp. E o outro tutorial, eu fiz tudo que ele pediu e quando entrei no game para testar, funcionava os golpes e as imunidades, porém não aparecia o número do dano e nem a cor.  Usei esse tutorial como base: 
      Pois ele é derivado. E o outro tutorial que usei foi: 
      Porém nesse, não consegui achar a const.h, e quando fui nos arquivos do creaturescript e adicionei uma cor nova a "COLOR_FAIRY", quando abro o jogo, os pokemons que seriam teoricamente "fada", o que eu usei de teste foi a Clefable. A Clefable tomava IK e dava IK no seu atk do tipo fada. 
      Além de que, o meu erro principal é esse: Warning - Monsters::loadMonster] Unknown race type fairy. (data/monster/pokes/geracao 1/Clefable.xml)
       Pois como eu já disse, não consigo achar onde adicionar uma nova race.

    • Por yuriowns
      Salve rapazes, tranquilo? Preciso de ajuda pra colocar para os npc's que vendem pots verificarem quantos itens possuem no tile em que o player está e se tiver com +80 itens no sqm, o npc avisa e não vende nada até o player ir em um sqm com menos de 80 itens no chão.
       
    • Por A.Mokk
      .Qual servidor ou website você utiliza como base? 
      TFS 0.4
      Qual o motivo deste tópico? 
      Bom pessoal, a algumas semanas atras eu joguei um servidor que havia sistema de imbuimento sendo 8.60, no servidor se utilizava a spellwand para encantar as armas, os comandos eram dado no canal Imbuiment... Gostaria de saber se alguém teria como disponibilizar algum sistema de imbuimento, já procurei pra caramba aqui no fórum mas tudo que encontro é pra versões acima da que eu uso.
       
    • Por Mateus Robeerto
      Não sei se aqui é a área ou algum local para solicitar a alteração do email antigo... Não lembro mais a senha dele, nem a resposta secreta para acessar. Peço a algum administrador ou moderador para, por favor, alterar o email para o novo.
  • Estatísticas dos Fóruns

    96846
    Tópicos
    519602
    Posts



×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo