Ir para conteúdo

Featured Replies

Postado

Para fechar o tópico é só selecionar alguma resposta como "melhor resposta", fechará automaticamente.

Te ajudei?
Se você achar que eu mereço, me dê uma "rep+" e selecione meu post como "melhor resposta"

 

Skype: JoadsonAion

  • Respostas 34
  • Visualizações 1.5k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • No caso do NPC Chat, o probema é simples: Pegue por exemplo essa fala de seu NPC: selfSay("Sorry, you don\'t have enough money.") Agora pegue como exemplo essa outra mensagem: selfSay('Sorry, you

  • O primeiro erro eu arrumei... já o segundo, não tenho idéia, porque no meu ot 10.35 funciona normal e é script de 8.60... tenta agora e ve se da erro.  

  • Flavio S. Cabral
    Flavio S. Cabral

    isso é minha assinatura se não percebeu rsrsrs

Postado
  • Autor

aff kk 

achei um bug no script

 

eu são 7 city free e 3 vips

 

falo com o npc, ir pra pra tal city free, e só vai pra goroma, todas que eu falo, só vai pra goroma

e as vips a mesma coisa, falo com qualquer uma das 3, e só vai pra 1

 

alguem pode me ajudar nisso ??

 

 

local free = {

 
        ["yalahar"] = {x=1555, y=2576, z=6},
["anknor"] = {x=487, y=261, z=6},
["goroma"] = {x=1367, y=195, z=6},
["smallville"] = {x=1995, y=2394, z=6},
["venonh"] = {x=238, y=370, z=6},
["alfon"] = {x=114, y=282, z=6},
["dorion"] = {x=31, y=79, z=6}
}
local vip = {
     
        ["everwood"] = {x=10386, y=10311, z=6},
      ["falelfia"] = {x=1348, y=1155, z=6},
      ["nunca"] = {x=114 ,y=282 ,z=6}
}
local cost = 100
 
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
npcHandler.topic = {}
 
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
 
       for city, tp in pairs(free) do
           if msgcontains(msg, city) then
              npcHandler:say('você tem certeza que quer viajar por 100 gold coin ?', cid)
              npcHandler.topic[cid] = 1
           elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
              if doPlayerRemoveMoney(cid, cost) then
                 doTeleportThing(cid, tp)
                 npcHandler:say('Let\'s GO', cid)
                 npcHandler.topic[cid] = 0
              else
                  npcHandler:say('Desculpe, você não tem dinheiro suficiente', cid)
                  npcHandler.topic[cid] = 0
              end
           end
       end
       
       
       for citys, tps in pairs(vip) do
           if msgcontains(msg, citys) then
              npcHandler:say('você tem certeza que quer viajar por 100 gold coin ?', cid)
              npcHandler.topic[cid] = 2
           elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 2 then
              if(getPlayerVipDays(cid) > 0) then
                 if doPlayerRemoveMoney(cid, cost) then
                    doTeleportThing(cid, tps)
                    npcHandler:say('Let\'s GO', cid)
                    npcHandler.topic[cid] = 0 
                 else
                    npcHandler:say('Desculpe, você não tem dinheiro suficiente', cid)
                    npcHandler.topic[cid] = 0   
                 end
              else
                  npcHandler:say('Você não tem VIP!', cid)
                  npcHandler.topic[cid] = 0
              end
           end
       end
       
       if msgcontains(msg, 'no') then
          npcHandler:say('Tchau! Volte Logo', cid)
          npcHandler.topic[cid] = 0
       end
                       
return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

n35408.gif

Postado

Tenta assim :

local free = {
	-- ["nome da city"] = {posx, posy, posz}
	
	["yalahar"] = {1555, 2576, 6},
	["anknor"] = {487, 261, 6},
	["goroma"] = {1367, 195, 6},
	["smallville"] = {1995, 2394, 6},
	["venonh"] = {238, 370, 6},
	["alfon"] = {114, 282, 6},
	["dorion"] = {31, 79, 6}
}
local vip = {
     
      ["everwood"] = {1086, 10311, 6},
      ["falelfia"] = {1348, 1155, 6},
      ["nunca"] = {114, 282, 6}
}
local cost = 100
 
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
npcHandler.topic = {}
 
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
 
       for city, tp in pairs(free) do
           if msgcontains(msg, city) then
              npcHandler:say('você tem certeza que quer viajar por 100 gold coin ?', cid)
              npcHandler.topic[cid] = 1
           elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
              if doPlayerRemoveMoney(cid, cost) then
                 doTeleportThing(cid, {x=tp[1], y=tp[2], z=tp[3]})
                 npcHandler:say('Let\'s GO', cid)
                 npcHandler.topic[cid] = 0
              else
                  npcHandler:say('Desculpe, você não tem dinheiro suficiente', cid)
                  npcHandler.topic[cid] = 0
              end
           end
       end
       
       
       for citys, tps in pairs(vip) do
           if msgcontains(msg, citys) then
              npcHandler:say('você tem certeza que quer viajar por 100 gold coin ?', cid)
              npcHandler.topic[cid] = 2
           elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 2 then
              if(getPlayerVipDays(cid) > 0) then
                 if doPlayerRemoveMoney(cid, cost) then
                    doTeleportThing(cid, {x=tps[1], y=tps[2], z=tps[3]})
                    npcHandler:say('Let\'s GO', cid)
                    npcHandler.topic[cid] = 0 
                 else
                    npcHandler:say('Desculpe, você não tem dinheiro suficiente', cid)
                    npcHandler.topic[cid] = 0   
                 end
              else
                  npcHandler:say('Você não tem VIP!', cid)
                  npcHandler.topic[cid] = 0
              end
           end
       end
       
       if msgcontains(msg, 'no') then
          npcHandler:say('Tchau! Volte Logo', cid)
          npcHandler.topic[cid] = 0
       end
                       
return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

EQD4Qy4.gif

Postado
  • Autor

 

Tenta assim :

local free = {
	-- ["nome da city"] = {posx, posy, posz}
	
	["yalahar"] = {1555, 2576, 6},
	["anknor"] = {487, 261, 6},
	["goroma"] = {1367, 195, 6},
	["smallville"] = {1995, 2394, 6},
	["venonh"] = {238, 370, 6},
	["alfon"] = {114, 282, 6},
	["dorion"] = {31, 79, 6}
}
local vip = {
     
      ["everwood"] = {1086, 10311, 6},
      ["falelfia"] = {1348, 1155, 6},
      ["nunca"] = {114, 282, 6}
}
local cost = 100
 
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
npcHandler.topic = {}
 
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
 
       for city, tp in pairs(free) do
           if msgcontains(msg, city) then
              npcHandler:say('você tem certeza que quer viajar por 100 gold coin ?', cid)
              npcHandler.topic[cid] = 1
           elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 1 then
              if doPlayerRemoveMoney(cid, cost) then
                 doTeleportThing(cid, {x=tp[1], y=tp[2], z=tp[3]})
                 npcHandler:say('Let\'s GO', cid)
                 npcHandler.topic[cid] = 0
              else
                  npcHandler:say('Desculpe, você não tem dinheiro suficiente', cid)
                  npcHandler.topic[cid] = 0
              end
           end
       end
       
       
       for citys, tps in pairs(vip) do
           if msgcontains(msg, citys) then
              npcHandler:say('você tem certeza que quer viajar por 100 gold coin ?', cid)
              npcHandler.topic[cid] = 2
           elseif msgcontains(msg, 'yes') and npcHandler.topic[cid] == 2 then
              if(getPlayerVipDays(cid) > 0) then
                 if doPlayerRemoveMoney(cid, cost) then
                    doTeleportThing(cid, {x=tps[1], y=tps[2], z=tps[3]})
                    npcHandler:say('Let\'s GO', cid)
                    npcHandler.topic[cid] = 0 
                 else
                    npcHandler:say('Desculpe, você não tem dinheiro suficiente', cid)
                    npcHandler.topic[cid] = 0   
                 end
              else
                  npcHandler:say('Você não tem VIP!', cid)
                  npcHandler.topic[cid] = 0
              end
           end
       end
       
       if msgcontains(msg, 'no') then
          npcHandler:say('Tchau! Volte Logo', cid)
          npcHandler.topic[cid] = 0
       end
                       
return true
end
 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

da o mesmo bug, todas as citys free vai pra goroma, e as premy, só vai pra falelfia ;x

up

n35408.gif

Postado

Não sei o porque de não funcionar com o for sendo que o valor retorna normal aqui no meu scite, então fiz o npc sem o uso do for (do jeito que eu não queria) ... mas pelo menos  vai funcionar 100%.

 

Coloquei o código no pastebin por motivos de organização.

 

http://pastebin.com/rGZ6qPnD

 

é o mesmo código só que no hastebin.

 

http://hastebin.com/gademoyuka.vhd

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

EQD4Qy4.gif

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