Ir para conteúdo
Banner com Efeitos

Featured Replies

Postado

O Npc fala duas veses e no default queria que ele  fala no chat ncp's

Citar

Torneio.lua 

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

if msgcontains(msg, 'torneio') or msgcontains(msg, 'enter') then

if getPlayerItemCount(cid, torneio.revivePoke) >= 1 then
selfSay('Voce nao Pode entrar no torneio com {revives}, por favor guarde eles e volte a falar comigo novamente.', cid)
return true
end

selfSay('Voce quer Participar no torneio por'..torneio.price..' HD?', cid)
talkState[talkUser] = 2


elseif talkState[talkUser] == 2 then

if msgcontains(msg, 'yes') or msgcontains(msg, 'sim') then

if os.date("%X") < torneio.startHour or os.date("%X") > torneio.endHour then
selfSay('As Inscrisoes para o torneiro terminaram, volte mais tarde', cid)
return true
end

if doPlayerRemoveMoney(cid, torneio.price) then
doTeleportThing(cid, torneio.waitPlace)
doPlayerSendTextMessage(cid, 21, "Bem vindo, esta e a sala de espera, voce espera aqui enquanto o torneio nao começa. Hora de inicio: {"..torneio.endHour.."}.")
else

selfSay('Voce não tem dinheiro suficiente ('..torneio.price..').', cid)
end
else
selfSay('Certeza que voce não quer Participar?Ok, ate a Proxima', cid)
talkState[talkUser] = 0
end
end
end

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

 

 

Citar

Torneio.xml

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Nick" script="torneio.lua" walkinterval="999000" floorchange="0">
<health now="150" max="150"/>
<look type="1806" head="20" body="100" legs="50" feet="99" corpse="111"/>]
<parameters>
<parameter key="message_greet" value="Ola |PLAYERNAME|. Sou o NIKE, Encarregado pelo Torneio diario caso queira entrar diga: {torneio}."/>
        </parameters>
</npc>

tyut.jpg

Postado

subistitua ali em npc para esse

e da rep+ se der ^^

 

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Nick" script="torneio.lua" walkinterval="2000" floorchange="0">
<health now="150" max="150"/>
<look type=" 1806 " head="20" body="100" legs="50" feet="99" corpse="2212"/>]
<parameters>
<parameter key="message_greet" value="Hello |PLAYERNAME|. If you want to participate in the tournament say: {torneio} or {enter}."/>
    </parameters>
</npc>

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

Postado
  • Autor

Nao funcionou e comeso  a dar esse erro 


[13/02/2016 16:12:43] [Error - Npc interface] 
[13/02/2016 16:12:43] data/npc/scripts/torneio.lua:onCreatureSay
[13/02/2016 16:12:43] Description: 
[13/02/2016 16:12:43] data/npc/scripts/torneio.lua:24: attempt to compare string with nil
[13/02/2016 16:12:43] stack traceback:
[13/02/2016 16:12:43]     data/npc/scripts/torneio.lua:24: in function 'callback'
[13/02/2016 16:12:43]     data/npc/lib/npcsystem/npchandler.lua:390: in function 'onCreatureSay'
[13/02/2016 16:12:43]     data/npc/scripts/torneio.lua:7: in function <data/npc/scripts/torneio.lua:7>

Postado
1 minute ago, Daniel augusto silva said:

Nao funcionou e comeso  a dar esse erro 


[13/02/2016 16:12:43] [Error - Npc interface] 
[13/02/2016 16:12:43] data/npc/scripts/torneio.lua:onCreatureSay
[13/02/2016 16:12:43] Description: 
[13/02/2016 16:12:43] data/npc/scripts/torneio.lua:24: attempt to compare string with nil
[13/02/2016 16:12:43] stack traceback:
[13/02/2016 16:12:43]     data/npc/scripts/torneio.lua:24: in function 'callback'
[13/02/2016 16:12:43]     data/npc/lib/npcsystem/npchandler.lua:390: in function 'onCreatureSay'
[13/02/2016 16:12:43]     data/npc/scripts/torneio.lua:7: in function <data/npc/scripts/torneio.lua:7>

pelo que vi deicha esse mesmo 

Torneio.xml

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Nick" script="torneio.lua" walkinterval="999000" floorchange="0">
<health now="150" max="150"/>
<look type="1806" head="20" body="100" legs="50" feet="99" corpse="111"/>]
<parameters>
<parameter key="message_greet" value="Ola |PLAYERNAME|. Sou o NIKE, Encarregado pelo Torneio diario caso queira entrar diga: {torneio}."/>
        </parameters>
</npc>

 

 

agr no caso substitua seu  Torneio.lua por esse pegue ele todo \/\/\/

 

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

if msgcontains(msg, 'torneio') or msgcontains(msg, 'enter') then

if getPlayerItemCount(cid, torneio.revivePoke) >= 1 then
selfSay('You can not enter the tournament with {revives}, please throw them out.', cid)
return true
end

selfSay('You want to participate in the tournament by '..torneio.price..' gps / dollars?', cid)
talkState[talkUser] = 2


elseif talkState[talkUser] == 2 then

if msgcontains(msg, 'yes') or msgcontains(msg, 'sim') then

if os.date("%X") < torneio.startHour or os.date("%X") > torneio.endHour then
selfSay('Registration for the tournament finished, come back later.', cid)
return true
end

if doPlayerRemoveMoney(cid, torneio.price) then
doTeleportThing(cid, torneio.waitPlace)
doPlayerSendTextMessage(cid, 21, "Welcome, this is the waiting room, you wait here while the tournament does not start. Start time: {"..torneio.endHour.."}.")
else

selfSay('You do not have enough money ('..torneio.price..').', cid)
end
else
selfSay('Sure you do not want to participate? Okay, see you next time!', cid)
talkState[talkUser] = 0
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.7k

Informação Importante

Confirmação de Termo