Ir para conteúdo

Featured Replies

Postado

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.

Resolvido por gabrielzika

Ir para solução
Postado
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)

Postado
  • Autor
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.

Postado
  • 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())

 

 

 

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