Ir para conteúdo

[Npc] De Troca !


Starliks

Posts Recomendados

Gente preciso de 3 npcs de troca que faça a seguinte função !

ou 1 npc que faça 3 tipos de troca em trade !

 

 

 

Estou usando esse mais ele não tira o item do player ! e sai distribuindo oq seria a troca !

se alquem tiver esse npc em forma de Trade !

 

O Player tem 10 crystal coin e quer troca por 1 item de refinar !

 

vo por os 3 scripts de troca q uso e nenhum deles esta funcionando !

 

 

 

 

-- NPC de troca - By Conde Sapo

local focus = 0

local talk_start = 0

local target = 0

local following = false

local attacking = false

local addon_state = 0

function onThingMove(creature, thing, oldpos, oldstackpos)

end

function onCreatureAppear(creature)

end

function onCreatureDisappear(cid, pos)

if focus == cid then

selfSay('Good bye then.')

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) < 4 then

selfSay('Olá ' .. getCreatureName(cid) .. '... Gostaria de troca ?... Você tem 10 Lagrimas Azuis ai? Eu posso te 1 Crystal Refiner em troca! DIGA TROCA PARA RECEBER SUA PEDRA!')

focus = cid

talk_start = os.clock()

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then

selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk to you in a minute.')

elseif focus == cid then

talk_start = os.clock()

if msgcontains(msg, 'alquimia') or msgcontains(msg, 'troca') then

if doPlayerRemoveItem(cid,2346,10) == 0 then

selfSay('Eu disse 10 Lagrimas Azuis!')

addon_state = 0

else

selfSay('Obrigado, muito mesmo! Tome, isto pode ser útil para você!')

doPlayerAddItem(cid, 8300, 1)

talk_start = 0

end

elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then

selfSay('Good bye, ' .. getCreatureName(cid) .. '! Come back soon..')

focus = 0

talk_start = 0

end

end

end

function onCreatureChangeOutfit(creature)

end

function onThink()

doNpcSetCreatureFocus(focus)

if (os.clock() - talk_start) > 30 then

if focus > 0 then

selfSay('Next Please...')

end

focus = 0

end

if focus ~= 0 then

if getDistanceToCreature(focus) > 5 then

selfSay('Good bye then.')

focus = 0

end

end

end

 

 

 

 

 

 

-- NPC de troca - By Conde Sapo

local focus = 0

local talk_start = 0

local target = 0

local following = false

local attacking = false

local addon_state = 0

function onThingMove(creature, thing, oldpos, oldstackpos)

end

function onCreatureAppear(creature)

end

function onCreatureDisappear(cid, pos)

if focus == cid then

selfSay('Good bye then.')

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) < 4 then

selfSay('Olá ' .. getCreatureName(cid) .. '... Gostaria de troca ?... Você tem 5 Pedra de alquimia vermelha aí? Eu posso te 1 pedra de alquimia azul em troca! DIGA TROCA PARA RECEBER SUA PEDRA!')

focus = cid

talk_start = os.clock()

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then

selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk to you in a minute.')

elseif focus == cid then

talk_start = os.clock()

if msgcontains(msg, 'alquimia') or msgcontains(msg, 'troca') then

if doPlayerRemoveItem(cid,2363,5) == 0 then

selfSay('Eu disse 5 Pedras Vermelhas!')

addon_state = 0

else

selfSay('Obrigado, muito mesmo! Tome, isto pode ser útil para você!')

doPlayerAddItem(cid, 2346, 1)

talk_start = 0

end

elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then

selfSay('Good bye, ' .. getCreatureName(cid) .. '! Come back soon..')

focus = 0

talk_start = 0

end

end

end

function onCreatureChangeOutfit(creature)

end

function onThink()

doNpcSetCreatureFocus(focus)

if (os.clock() - talk_start) > 30 then

if focus > 0 then

selfSay('Next Please...')

end

focus = 0

end

if focus ~= 0 then

if getDistanceToCreature(focus) > 5 then

selfSay('Good bye then.')

focus = 0

end

end

end

 

 

 

 

 

 

-- NPC de troca - By Conde Sapo

local focus = 0

local talk_start = 0

local target = 0

local following = false

local attacking = false

local addon_state = 0

function onThingMove(creature, thing, oldpos, oldstackpos)

end

function onCreatureAppear(creature)

end

function onCreatureDisappear(cid, pos)

if focus == cid then

selfSay('Good bye then.')

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) < 4 then

selfSay('Olá ' .. getCreatureName(cid) .. '... Quer Troca Life Crystal Por Pedra de Alquimia Vermelha?... Você tem 10 sobrando aí? Eu posso te da Pedra de Alquimia Vermelha!DIGA TROCA PARA RECEBER SUA PEDRA')

focus = cid

talk_start = os.clock()

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then

selfSay('Sorry, ' .. getCreatureName(cid) .. '! I talk to you in a minute.')

elseif focus == cid then

talk_start = os.clock()

if msgcontains(msg, 'alquimia') or msgcontains(msg, 'troca') then

if doPlayerRemoveItem(cid,2177,10) == 0 then

selfSay('Eu disse 10 Life Crystal!')

addon_state = 0

else

selfSay('Obrigado, muito mesmo! Tome, isto pode ser útil para você!')

doPlayerAddItem(cid, 2363, 1)

talk_start = 0

end

elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then

selfSay('Good bye, ' .. getCreatureName(cid) .. '! Come back soon..')

focus = 0

talk_start = 0

end

end

end

function onCreatureChangeOutfit(creature)

end

function onThink()

doNpcSetCreatureFocus(focus)

if (os.clock() - talk_start) > 30 then

if focus > 0 then

selfSay('Next Please...')

end

focus = 0

end

if focus ~= 0 then

if getDistanceToCreature(focus) > 5 then

selfSay('Good bye then.')

focus = 0

end

end

end

 

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...