Ir para conteúdo
  • Cadastre-se

(Resolvido)[PEDIDO] Npc de Viajem


Ir para solução Resolvido por gabrielzika,

Posts Recomendados

Venho através deste topico pedir um npc de viajem mais um pouco diferente você pode viajar com ele somente uma vez, caso tente viajar mais de uma vez aparece uma mensagem dizendo algo como você já viajou comigo!, e queria também que para viajar ser preciso um x level desde já agradeço <3.

Link para o post
Compartilhar em outros sites
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
local config = {
                 
level = 300,	-- Level que precisara para viajar
sto = 44444,	-- Storage não mecher
pos = {x = 2592, y = 1152, z = 7}, -- Position para onde o player sera teleportado    

}
if(msgcontains(msg, 'yes' )) then
	if getPlayerStorageValue(cid, config.sto) == -1 then
		if getPlayerLevel(cid) >= config.level  then
			selfSay('Parábens', cid)
			setPlayerStorageValue(cid, config.sto, 1)
			doTeleportThing(cid, config.pos)
		else
			selfSay('Você não tem o level necessário.', cid)
		end
	else
		selfSay('você já viajou comigo!' , cid)
	return true
	end
end
end

 

xml

 

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Luis" script="NomeDoArquivo.lua" walkinterval="0" floorchange="0">
<health now="150" max="150"/>
<look type="826" head="20" body="100" legs="50" feet="99" corpse="2212"/>
<parameters>
<parameter key="message_greet" value="Ola |PLAYERNAME|. Deseja viajar comigo?."/>
</parameters>
</npc>

@bismarkzika

Editado por gabrielzika (veja o histórico de edições)
Link para o post
Compartilhar em outros sites
1 hora atrás, gabrielzika disse:

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
local config = {
                 
level = 300,	-- Level que precisara para viajar
sto = 44444,	-- Storage não mecher
pos = {x = 2592, y = 1152, z = 7}, -- Position para onde o player sera teleportado    

}
if(msgcontains(msg, 'yes' )) then
	if getPlayerStorageValue(cid, config.sto) == -1 then
		if getPlayerLevel(cid) >= config.level  then
			selfSay('Parábens', cid)
			setPlayerStorageValue(cid, config.sto, 1)
			doTeleportThing(cid, config.pos)
		else
			selfSay('Você não tem o level necessário.', cid)
		end
	else
		selfSay('você já viajou comigo!' , cid)
	return true
	end
end
end

 

xml

 


<?xml version="1.0" encoding="UTF-8"?>
<npc name="Luis" script="NomeDoArquivo.lua" walkinterval="0" floorchange="0">
<health now="150" max="150"/>
<look type="826" head="20" body="100" legs="50" feet="99" corpse="2212"/>
<parameters>
<parameter key="message_greet" value="Ola |PLAYERNAME|. Deseja viajar comigo?."/>
</parameters>
</npc>

@bismarkzika

 

Obrigado vou testar aqui.

2 horas atrás, gabrielzika disse:

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
local config = {
                 
level = 300,	-- Level que precisara para viajar
sto = 44444,	-- Storage não mecher
pos = {x = 2592, y = 1152, z = 7}, -- Position para onde o player sera teleportado    

}
if(msgcontains(msg, 'yes' )) then
	if getPlayerStorageValue(cid, config.sto) == -1 then
		if getPlayerLevel(cid) >= config.level  then
			selfSay('Parábens', cid)
			setPlayerStorageValue(cid, config.sto, 1)
			doTeleportThing(cid, config.pos)
		else
			selfSay('Você não tem o level necessário.', cid)
		end
	else
		selfSay('você já viajou comigo!' , cid)
	return true
	end
end
end

 

xml

 


<?xml version="1.0" encoding="UTF-8"?>
<npc name="Luis" script="NomeDoArquivo.lua" walkinterval="0" floorchange="0">
<health now="150" max="150"/>
<look type="826" head="20" body="100" legs="50" feet="99" corpse="2212"/>
<parameters>
<parameter key="message_greet" value="Ola |PLAYERNAME|. Deseja viajar comigo?."/>
</parameters>
</npc>

@bismarkzika

 

@gabrielzika Eu falo hi mais o npc não responde.

Link para o post
Compartilhar em outros sites
  • Solução

@bismarkzika

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
local config = {
                 
level = 300,    -- Level que precisara para viajar
sto = 44444,    -- Storage não mecher
pos = {x = 1037, y = 1036, z = 7}, -- Position para onde o player sera teleportado    

}
if msgcontains(msg, 'yes') then
    if getPlayerStorageValue(cid, config.sto) < 1 then
        if getPlayerLevel(cid) >= config.level  then
            selfSay('Parábens', cid)
            setPlayerStorageValue(cid, config.sto, 1)
            doTeleportThing(cid, config.pos)
        else
            selfSay('Você não tem o level necessário.', cid)
        end
    else
        selfSay('você já viajou comigo!' , cid)
    return true
    end
end
end

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

 

 

 

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.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo