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
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
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+
Sou especializado em: Scripts, Mapping, Bugs, Admin entre outros.
Gostou do que eu faço? Então adicionem: kamui_lg@hotmail.com
@Kamuihunt Seria de grande utilidade se você adicionasse a citação em bloco ou a tag para códigos em seus scripts, isso seria de grande ajuda para o entendimento do mesmo, inclusive para a própria pessoa que solicitou o script. Em script grandes, também pode-ser usar a tag de spoiler.
Oie :D
local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} 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 local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid if(msgcontains(msg, 'bank') or msgcontains(msg, 'BANK')) then selfSay('Olá amigo oque deseja fazer? {deposit} para depositar, {withdraw} para retirar ou {balance} para ver seu saldo!', cid) talkState[talkUser] = 1 elseif msgcontains(msg, 'balance') or msgcontains(msg, 'BALANCE') and talkState[talkUser] == 1 then local balance = getPlayerBalance(cid) selfSay('Voce possui ' .. balance .. ' gp no banco', cid) elseif msgcontains(msg, 'deposit') or msgcontains(msg, 'DEPOSIT') and talkState[talkUser] == 1 then selfSay('Digite o valor que você quer depositar.', cid) talkState[talkUser] = 2 elseif talkState[talkUser] == 2 then n = getNumber(msg) if(msg == 'all' and doPlayerDepositAllMoney(cid)) then selfSay('Depositado com sucesso!', cid) talkState[talkUser] = 1 end if n <= 0 then selfSay('escolha um valor acima de 0!', cid) talkState[talkUser] = 1 end if n and doPlayerDepositMoney(cid, n) then selfSay('Depositado com sucesso!', cid) talkState[talkUser] = 1 else selfSay('Voce nao tem o valor informado', cid) talkState[talkUser] = 1 end elseif msgcontains(msg, 'withdraw') or msgcontains(msg, 'WITHDRAW') and talkState[talkUser] == 1 then selfSay('Digite o valor que você quer retirar.', cid) talkState[talkUser] = 3 elseif talkState[talkUser] == 3 then n = getNumber(msg) local balance = getPlayerBalance(cid) if(msg == 'all' and doPlayerWithdrawAllMoney(cid)) then selfSay('Retirado ' .. balance .. 'gp da sua conta!', cid) talkState[talkUser] = 1 end if (n ~= 0 and doPlayerWithdrawMoney(cid, n)) then selfSay('Retirado ' .. n .. 'gp da sua conta!', cid) talkState[talkUser] = 1 else selfSay('Voce nao pode retirar esse valor!', cid) talkState[talkUser] = 1 end elseif msg == "no" and talkState[talkUser] >= 1 then selfSay("Then not", cid) talkState[talkUser] = 0 npcHandler:releaseFocus(cid) end return TRUE end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new()) function getNumber(txt) x = string.gsub(txt,"%a","") x = tonumber(x) if x ~= nill and x > 0 then return x else return 0 end end
Não funcionou, substitui isso lá em Bank.lua e dei reload, falei hi com o npc ele nem me respondeu.
alguem pode responder com um script e topico mais explicado?
thanks
@edit
Já resolvi, thanks
@Kamuihunt Seria de grande utilidade se você adicionasse a citação em bloco ou a tag para códigos em seus scripts, isso seria de grande ajuda para o entendimento do mesmo, inclusive para a própria pessoa que solicitou o script. Em script grandes, também pode-ser usar a tag de spoiler.
Sim cara, entendo perfeitamente, é que esse ja veio sem a tag, e apenas foi editado.
No máximo eu colocaria a minha, mas como eu não fiz, correria o risco de Ripping.
'-'
Sou especializado em: Scripts, Mapping, Bugs, Admin entre outros.
Gostou do que eu faço? Então adicionem: kamui_lg@hotmail.com
Perfeito Vodkart, aqui deu certo =)
Hell Server - 24h - 8.6 - Rate 20x -> acesse já:
http://hellserver.no-ip.info