Ir para conteúdo

Featured Replies

  • Respostas 8
  • Visualizações 574
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • data\npc  crie um arquivo.xml e renomeio para Teleport.xml e cole isso:  <?xml version="1.0" encoding="UTF-8"?> <npc name="Teleport" script="teleport.lua" speed="0"> <health now="15

Postado
  • Autor

isso aqui ?? .. focus = 0

talk_start = 0
target = 0
following = false
attacking = false
 
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
   selfSay('See ya.')
   focus = 0
   talk_start = 0
end
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
 
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 3 then
   selfSay('Olá a entrada no Saffari custará 1k vc aceita??')
   focus = cid
   talk_start = os.clock()
elseif (msgcontains(msg, 'yes') ) then
   if getPlayerItemCount(cid,2391) >= 1 or getPlayerItemCount(cid,2394) >= 1 or getPlayerItemCount(cid,2392) >= 1 or getPlayerItemCount(cid,2393) >= 1 then
      selfSay("Você não pode entrar no Saffari com nenhuma outra ball exceto a Saffari!! Cya")
      focus = 0
      talk_start = 0
   elseif getPlayerStorageValue(cid, 98796) >= 1 or getPlayerStorageValue(cid, 98797) >= 1 then
      selfSay("Você já está na saffari zone!")
      focus = 0
      talk_start = 0
   elseif doPlayerRemoveMoney(cid, 100000) then --1000dl --alterado v1.9
      setPlayerStorageValue(cid, 98796, 1)
      setPlayerStorageValue(cid, 98797, 1)
      doPlayerAddItem(cid, 12617, 70)  --alterado v1.9
      doTeleportThing(cid, SafariEnter)
      doSendMagicEffect(getThingPos(cid), 21)
      talk_start = os.clock()
   else
      selfSay("Você não tem dinheiro suficiente")   --alterado v1.9
      focus = 0
      talk_start = 0
   end
elseif (msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 3) then
   selfSay('Sorry, Im busy at this moment.')
elseif (msgcontains(msg, 'bye') and focus == cid and getDistanceToCreature(cid) < 3) then
   selfSay('Good bye then.')
   focus = 0
   talk_start = 0
end
end
 
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('See ya.')
end
focus = 0
end
end
Postado
  • Solução

data\npc  crie um arquivo.xml e renomeio para Teleport.xml

e cole isso: 

<?xml version="1.0" encoding="UTF-8"?>
<npc name="Teleport" script="teleport.lua" speed="0">
<health now="150" max="150"/>
<look type="511" head="91" body="114" legs="86" feet="0"/>
</npc>

 

data\npc\script crie um arquivo.lua e renomeio para teleport.lua 

cole isso:

local lugar = {x=102, y=1027, z=7}

local item = 2160
local quantidade = 10

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

function santaNPC(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if (parameters.present == true) then
if(doPlayerRemoveItem(cid,item,quantidade) == true) then
doTeleportThing(cid, lugar)
npcHandler:say('Voce foi teleportado.',cid)
else
npcHandler:say('Voce não tem o item para ser teleportado',cid)
end
npcHandler:resetNpc()
return true
end
end

npcHandler:setMessage(MESSAGE_GREET, "Ola|PLAYERNAME|. Eu posso te levar para alguns lugares,fale {lugar}.")

local noNode = KeywordNode:new({'no'}, santaNPC, {present = false})
local yesNode = KeywordNode:new({'yes'}, santaNPC, {present = true})

local node = keywordHandler:addKeyword({'lugar'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Vou te levar para um lugar,digite {yes}'})
node:addChildKeywordNode(yesNode)
node:addChildKeywordNode(noNode)
npcHandler:addModule(FocusModule:new())

 

Editando;; 

local lugar =  {x=102, y=1027, z=7}                  --  Lugar da Hunt

local item = 2160                                               --  ID do diamond
local quantidade = 10                                       --  quantidade de diamond

Postado
  • Autor

Obgr ... quando eu chegar em casa euo vou testa-lo e se der Certo .. vou por o seu nome .. no Npc.. :D *-* Obgr .. por sempre esta me Ajudando ..

Deu Certo Annafeeh .. Muito Obgr..

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