Olá galera do TK, estou com este script de NPC, e de viagem fica no barco, mas para viajar nele e preciso um passaporte. tenho o script aqui só que o player compra qualquer passaporte e vai para qualquer city e eu não quero assim...se alguém puder me ajudar.. queria que rescrevesse esse script da seguinte forma o passaport ja vem com o nome da cidade tipo passaporte [nome da city] e só deve viajar par city que tiver o nome no passaporte.
NPC de Viajem
local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false[/size][/i]
[i][size=5]function onThingMove(creature, thing, oldpos, oldstackpos)end
function onCreatureAppear(creature)end[/size][/i]
[i][size=5]function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.', cid)
focus = 0
talk_start = 0
end
end[/size][/i]
[i][size=5]function onCreatureTurn(creature)end[/size][/i]
[i][size=5]function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end[/size][/i]
[i][size=5]function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'hi') and focus == 0) and getDistanceToCreature(cid) < 4 then
selfSay('Ola ' .. getCreatureName(cid) .. '! Qual {city} você deseja ir?', cid)
focus = cid
talk_start = os.clock()[/size][/i]
[i][size=5]elseif msgcontains(msg, 'artemisias') or msgcontains(msg, 'arte') then
selfSay('Voce deseja ir para {Artemisias}?', cid)
talk_state = 1
talk_start = os.clock()
elseif talk_state == 1 and msgcontains(msg, 'yes') then
if getPlayerItemCount(cid,1954) >= 1 then
doPlayerRemoveItem(cid,1954,1)
selfSay('Boa Viagem aventureiro!', cid)
doTeleportThing(cid,{x=1010, y=1198, z=6})
else
selfSay('Desculpe, voce nao tem os itens necessarios!', cid)
end[/size][/i]
[i][size=5]elseif msgcontains(msg, 'nissea') or msgcontains(msg, 'city 2') then
selfSay('Voce deseja ir para {Nissea}?', cid)
talk_state = 2
talk_start = os.clock()
elseif talk_state == 2 and msgcontains(msg, 'yes') then
if getPlayerItemCount(cid,1954) >= 1 then
doPlayerRemoveItem(cid,1954,1)
selfSay('Boa Viagem aventureiro!', cid)
doTeleportThing(cid,{x=532, y=757, z=6})
else
selfSay('Desculpe, voce nao tem os itens necessarios!', cid)
end[/size][/i]
[i][size=5]elseif msgcontains(msg, 'valentia') or msgcontains(msg, 'city 3') then
selfSay('Voce deseja ir para {Valentia}?', cid)
talk_state = 3
talk_start = os.clock()
elseif talk_state == 3 and msgcontains(msg, 'yes') then
if getPlayerItemCount(cid,1954) >= 1 then
doPlayerRemoveItem(cid,1954,1)
selfSay('Boa Viagem aventureiro!', cid)
doTeleportThing(cid,{x=398, y=990, z=6})
else
selfSay('Desculpe, voce nao tem os itens necessarios!', cid)
end[/size][/i]
[i][size=5]elseif msgcontains(msg, 'styge') or msgcontains(msg, 'city 4') then
selfSay('Voce deseja ir para {Styge}?', cid)
talk_state = 4
talk_start = os.clock()
elseif talk_state == 4 and msgcontains(msg, 'yes') then
if getPlayerItemCount(cid,1954) >= 1 then
doPlayerRemoveItem(cid,1954,1)
selfSay('Boa Viagem aventureiro!', cid)
doTeleportThing(cid,{x=595, y=1620, z=6})
else
selfSay('Desculpe, voce nao tem os itens necessarios!', cid)
end[/size][/i]
[i][size=5]elseif msgcontains(msg, 'horpus') or msgcontains(msg, 'city 5') then
selfSay('Voce deseja ir para {Horpus}?', cid)
talk_state = 5
talk_start = os.clock()
elseif talk_state == 5 and msgcontains(msg, 'yes') then
if getPlayerItemCount(cid,1954) >= 1 then
doPlayerRemoveItem(cid,1954,1)
selfSay('Boa Viagem aventureiro!', cid)
doTeleportThing(cid,{x=1054, y=428, z=6})
else
selfSay('Desculpe, voce nao tem os itens necessarios!', cid)
end[/size][/i]
[i][size=5]elseif msgcontains(msg, 'kypros') or msgcontains(msg, 'egeu') then
selfSay('Voce deseja ir para {Kypros}?', cid)
talk_state = 6
talk_start = os.clock()
elseif talk_state == 6 and msgcontains(msg, 'yes') then
if getPlayerItemCount(cid,1954) >= 1 then
doPlayerRemoveItem(cid,1954,1)
selfSay('Boa Viagem aventureiro!', cid)
doTeleportThing(cid,{x=1383, y=527, z=6})
else
selfSay('Desculpe, voce nao tem os itens necessarios!', cid)
end[/size][/i]
[i][size=5]elseif msgcontains(msg, 'helmet of the deep') or msgcontains(msg, 'trade') then
selfSay('Voce tem os 5000 gold coin para comprar 1 Helmet of the Deep?', cid)
talk_state = 7
talk_start = os.clock()
elseif talk_state == 7 and msgcontains(msg, 'yes') then[/size][/i]
[i][size=5]if doPlayerRemoveMoney(cid, 5000) == TRUE then
selfSay('Parabens! Voce adquiriu um item!', cid)
doPlayerAddItem(cid,5461,1)
else
selfSay('Desculpe, voce nao tem dinheiro suficiente!', cid)
end[/size][/i]
[i][size=5]elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Bye ' .. getCreatureName(cid) .. ', Come back.', cid)
focus = 0
talk_start = 0
elseif msgcontains(msg, 'me xupa') then
selfSay('What?', cid)
talk_state = 0
end
end[/size][/i]
[i][size=5]function onCreatureChangeOutfit(creature)end
function onThink()
doNpcSetCreatureFocus(focus)
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Next...', cid)
end
focus = 0
talk_start = 0
end[/size][/i]
[i][size=5]if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good Bye', cid)
focus = 0
talk_start = 0
end
end
end