Olá galera, alguem tem script de NPC Bank?
O meu está bugado, não da pra depositar.
Gostaria de um NPC pra colocar no Global 8.60
De preferencia com as seguintes funções:
Deposit, withdraw, transfer (:
thank you
Ta ai traduzidinho ![]()
local focus = 0
local talk_start = 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('Ola ' .. creatureGetName(cid) .. '! Bem vindo ao banco local!')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Espere, ' .. creatureGetName(cid) .. '! Falo com voce em um minuto...')
elseif focus == cid then
if msgcontains(msg, 'balance') then
balance(cid)
talk_state = 0
talk_start = os.clock()
elseif msgcontains(msg, 'deposit') and getCount(msg) > 0 then
value = getCount(msg)
selfSay('Voce realmente quer depositar '..value..' gps?')
talk_state = 2
talk_start = os.clock()
elseif msgcontains(msg, 'deposit') then
selfSay('Por favor me diga quanto voce quer depositar...')
talk_state = 1
talk_start = os.clock()
elseif talk_state == 1 then
value = getCount(msg)
if value > 0 then
selfSay('Voce realmente quer depositar '..value..' gps?')
talk_state = 2
else
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 2 then
deposit(cid, value)
talk_state = 0
elseif msgcontains(msg, 'transfer') and getCount(msg) > 0 then
value = getCount(msg)
selfSay('Qual o NOME do Player para quem voce quer transferir '..value..' gps?')
talk_state = 5
talk_start = os.clock()
elseif talk_state == 5 then
xid = getPlayerByName(msg)
if xid == 0 then
selfSay('Player "'..msg..'" nao encontrado!!!')
talk_state = 0
elseif xid == cid then
selfSay('Voce nao pode transferir dinheiro para voce mesmo!!!')
talk_state = 0
else
NomeDele = getPlayerName(xid)
selfSay('Tem certeza que voce quer transferir '..value..' gps da sua conta para '..NomeDele..'?')
talk_state = 8
end
elseif msgcontains(msg, 'transfer') then
selfSay('Por favor me diga o quanto voce quer transferir?')
talk_state = 7
talk_start = os.clock()
elseif talk_state == 7 then
value = getCount(msg)
if value > 0 then
selfSay('Qual o NOME do Player para quem voce quer transferir '..value..' gps?')
talk_state = 5
talk_start = os.clock()
else
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 8 then
transfer(cid, value, xid)
talk_state = 0
elseif msgcontains(msg, 'withdraw') and getCount(msg) > 0 then
value = getCount(msg)
selfSay('Voce realmente que retirar '..value..' gps da sua conta?')
talk_state = 3
talk_start = os.clock()
elseif msgcontains(msg, 'withdraw') then
talk_state = 4
selfSay('Por favor me diga o quanto voce quer retirar.')
talk_start = os.clock()
elseif talk_state == 4 then
value = getCount(msg)
if value > 0 then
selfSay('Tem certeza que quer retirar '..value..' gps da sua conta?')
talk_state = 3
else
talk_state = 0
end
elseif msgcontains(msg, 'yes') and talk_state == 3 then
withdraw(cid, value)
talk_state = 0
elseif msgcontains(msg, 'no') and talk_state == 2 then
selfSay('Como quiser, algo mais que eu possa fazer por voce?')
talk_state = 0
elseif msgcontains(msg, 'no') and talk_state == 3 then
selfSay('Voce que sabe, volte quando quiser falar de dinheiro.')
talk_state = 0
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Adeus ' .. creatureGetName(cid) .. ', volte quando quiser falar de dinheiro.')
focus = 0
talk_start = 0
elseif msg ~= "" then
selfSay('Voce esta num banco! Fale sobre coisas que se faz num BANCO!')
talk_state = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
doNpcSetCreatureFocus(focus)
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Proximo!!...')
end
focus = 0
talk_start = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Adeus, volte quando tiver mais dinheiro!')
focus = 0
talk_start = 0
end
end
end
-
Qualquer coisa da um toque no e-mail ;D
E se te ajudei, claro rep + ;D
T+







info
Grupo: Artesão
Registrado: 09/08/07
Posts: 138
Reputação: +1
Char no Tibia: Gabii'zinhaa
Olá galera, alguem tem script de NPC Bank?
O meu está bugado, não da pra depositar.
Gostaria de um NPC pra colocar no Global 8.60
De preferencia com as seguintes funções:
Deposit, withdraw, transfer (:
thank you