Postado Julho 3, 2013 13 anos Gente, eu nunca postei nada aqui no Tibia King, nem sei se estou postando no lugar correto, então se eu n estou por favor movam meu topico.. Meu pedido é o seguindo, eu estou montando um Naruto Tibia 7.81 . E eu preciso muito que um de vcs me ajudem a montar o npc de Account Manager.. Na vdd ja Existe o npc, cujo script vou postar logo em baixo, mais o problema é que este npc Gera as Accounts sozinho, eu queria que os Players pudesse criar o próprio login, por que é muito chato ficar anotando o login que o npc gera ;S. ### Meu pedido é esse, quero que um de vocês por favor mude as scripts do Npc e faça com que o player gere o proprio login, e se for possivel queria pedir tambem que se alguem soubesse, fazer com que o npc tambem pudesse mudar a senha da Account.. OBRIGADO ### ~~~ SCRIPT ACCOUNT MANAGER ~~ ---little config----------------------------------------- templex = 94 templey = 42 templez = 7 maxnamelen = 18 maxpasslen = 14 startlvl = 1 startexp = 0 vocations = 0 healthstart = 150 manastart = 0 depoitemid = 3440 promoted = 0 ---------skills------------------------- --knight------- kmlvl = 0 kfist = 10 kclub = 10 ksword = 10 kaxe = 10 kdist = 10 kshield = 10 kfish = 0 kcap = 300 --pall------------ pmlvl = 0 pfist = 10 pclub = 10 psword = 10 paxe = 10 pdist = 10 pshield = 10 pfish = 0 pcap = 400 ---drut i sorc---- mmlvl = 0 mfist = 10 mclub = 10 msword = 10 maxe = 10 mdist = 10 mshield = 10 mfish = 0 mcap = 400 ---end skills ------------------------------- --~Tr0p5 (20% and players.xml) ---end little config----------------------------------------- focus = 0 talk_start = 0 target = 0 following = false attacking = false accstatus = 0 seksik = 3 myname = '' mypass = '' allow_pattern = '^[a-zA-Z -]+$' allow_pattern2 = '^[a-zA-Z0-9 -]+$' origmsg = '' mypasscheck = '' mynamecheck = '' vocation = 0 function onThingMove(creature, thing, oldpos, oldstackpos) end function onCreatureAppear(creature) end function onCreatureDisappear(cid, pos) if focus == cid then selfSay('Tchau, Tchau.') 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) origmsg = msg msg = string.lower(msg) if (msgcontains(msg, 'hi') and focus == 0) and getDistanceToCreature(cid) < 4 then selfSay('Ola, Seja bem vindo ao Real Shinobi Life! Sou o npc que crio accounts. Você é um homem ou uma mulher?') accstatus = 1 myname = '' mypass = '' myaccnumber = 0 focus = cid talk_start = os.clock() elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then selfSay('Espere..') elseif focus == cid then talk_start = os.clock() if accstatus == 1 then if msgcontains(msg, 'homem') then selfSay('Qual é seu nome caro Shinobi?') seksik = 28 outfit = 25 accstatus = 2 elseif msgcontains(msg, 'mulher') then selfSay('Qual é seu nome cara Shinobi?') seksik = 0 outfit = 25 accstatus = 2 end elseif accstatus == 66 then if msgcontains(msg, 'yes') then vocation = 0 selfSay('Now, we\'ll make your account. So, let\'s start?') elseif msgcontains(msg, 'asdsdf') then vocation = 0 selfSay('The dangerous magic casting sorcerer?') elseif msgcontains(msg, 'asdpois') then vocation = 0 selfSay('The magical warrior of nature?') elseif msgcontains(msg, 'coiusiotuyd') then vocation = 0 selfSay('The heavy built warrior?') else selfSay('Spell properly.') end accstatus = 67 elseif accstatus == 2 then myname = origmsg mynamecheck = msg if string.len(mynamecheck) <= maxnamelen then if string.find(mynamecheck, allow_pattern) then if io.open("data/players/"..myname..".xml" , "r") == nil then selfSay('Certesa que sera '..myname..' o Seu nome ?') accstatus = 3 else selfSay('Seu nome já está sendo usado, por favor escolha outro.') end else selfSay('Seu nome é ilegal/ofensivo.') end else selfSay('Seu nome está muito longo, por favor o diminua.') end elseif msgcontains(msg, 'yes') then if accstatus == 3 then if vocations == 0 then selfSay('Ok, agora me fale qual sera a sua senha?.') vocation = 0 accstatus = 4 else selfSay('You\'ll be a student, right?') accstatus = 66 end elseif accstatus == 5 then if seksik == 0 then selfSay('Perfeito! Você é uma Shinobi chamada: '..myname..' sua senha é: '..mypass..'. Certo?') else selfSay('Perfeito! Você é um Shinobi chamado: '..myname..' sua senha é: '..mypass..'. Certo?') end accstatus = 6 elseif accstatus == 6 then selfSay('Ok, agora vamos ver sua account. Diga "pronto" para continuar.') accstatus = 7 elseif accstatus == 67 then selfSay('Fale-me a sua senha.') accstatus = 4 end elseif msgcontains(msg, 'not') then if accstatus == 3 then selfSay('Choose another.') accstatus = 2 elseif accstatus == 5 then selfSay('Choose another.') accstatus = 4 elseif accstatus == 6 then selfSay('Start again, tell me your gender') accstatus = 1 elseif accstatus == 67 then selfSay('Are you able to be a Student?') accstatus = 66 end elseif accstatus == 4 then mypass = origmsg mypasscheck = msg if string.len(mypasscheck) <= maxpasslen then if string.find(mypasscheck, allow_pattern2) then selfSay('Sua senha é '..mypass..' certo?') accstatus = 5 else selfSay('Ilegal.') end else selfSay('Too long.') end elseif msgcontains(msg, 'pronto') and accstatus == 7 then if manastart == 0 then manastartc = 1 else manastartc = manastart end if healthstart == 0 then healthstartc = 1 else healthstartc = healthstart end if vocations == 0 then mlvl = 1 fist = 10 club = 10 sword = 10 axe = 10 dist = 10 shield = 10 fish = 10 cap = 100 else if vocation == 3 or vocation == 4 then mlvl = mmlvl fist = mfist club = mclub sword = msword axe = maxe dist = mdist shield = mshield fish = mfish cap = mcap elseif vocation == 2 then mlvl = pmlvl fist = pfist club = pclub sword = psword axe = paxe dist = pdist shield = pshield fish = pfish cap = pcap elseif vocation == 1 then mlvl = kmlvl fist = kfist club = kclub sword = ksword axe = kaxe dist = kdist shield = kshield fish = kfish cap = kcap end end myaccnumber = math.random(100000,999999) if io.open("data/accounts/"..myaccnumber..".xml" , "r") == nil then selfSay('Numero De Conta e: '..myaccnumber..' fale "next"') accstatus = 8 f = assert(io.open("./data/accounts/"..myaccnumber..".xml", "w")) f = io.open("./data/accounts/"..myaccnumber..".xml", "w") f:write("<?xml version=\"1.0\"?><account pass=\""..mypass.."\" type=\"1\" premDays=\"0\"><characters><character name=\""..myname.."\"\/><\/characters><\/account>") f:close() f = assert(io.open("./data/players/"..myname..".xml", "w")) f = io.open("./data/players/"..myname..".xml", "w") f:write("<?xml version=\"1.0\"?><player name=\""..myname.."\" id=\"" ..myaccnumber.."\" account=\""..myaccnumber.."\" sex=\""..seksik.."\" lookdir=\"2\" exp=\"0\" voc=\"0\" level=\"1\" access=\"0\" cap=\"200\" maglevel=\"0\" maxdepotitems=\"1000\" lastlogin=\"0\" lastlogout=\"0\" premmium=\"0\" promoted=\"0\" soul=\"100\" warning=\"0\" red=\"0\" banTicks=\"0\" reason=\"\" rook=\"0\" sleeping=\"0\" knowaddon=\"0\" lookaddon=\"0\"><spawn x=\"104\" y=\"72\" z=\"7\"\/><temple x=\"104\" y=\"72\" z=\"7\"\/><health now=\"150\" max=\"150\" food=\"0\"\/><mana now=\"0\" max=\"0\" spent=\"0\"\/><look type=\"" ..outfit.."\" head=\"77\" body=\"79\" legs=\"78\" feet=\"77\"\/><guild name=\"\" rank=\"\" nick=\"\" id=\"\"/><skills><skill skillid=\"0\" level=\"10\" tries=\"0\"\/><skill skillid=\"1\" level=\"10\" tries=\"0\"\/><skill skillid=\"2\" level=\"10\" tries=\"0\"\/><skill skillid=\"3\" level=\"10\" tries=\" 0 \" \/><skill skillid=\"4\" level=\"10\" tries=\"0\"\/><skill skillid=\"5\" level=\"10\" tries=\"0\"\/><skill skillid=\"6\" level=\"10\" tries=\"0\"\/><\/skills><spells><spell words=\"kagemane_velo\"/></spells><ban comment=\"\" action=\"\"/><skull redskulltime=\"0\" redskull=\"0\"/><deaths\/><spells\/><inventory><slot slotid=\"3\"><item id=\"1987\"><inside><item id=\"2674\" count=\"2\"/></inside></item></slot><slot slotid=\"4\"><item id=\"2509\"/></slot><slot slotid=\"6\"><item id=\"2379\"/></slot><slot slotid=\"8\"><item id=\"2643\"/></slot></inventory><depots><depot depotid=\"1\"><item id=\"2590\" depot=\"0\"><inside><item id=\"2594\"/></inside></item></depot></depots><storage\/></player>") f:close() r22 = math.random(10,99999) h = io.open("./data/players/players.xml", "r") h:read() doop = h:read("*a") h:close() g = io.open("./data/players/players.xml", "w") g:write("<players>\n<player guid=\""..r22.."\" name=\""..myname.."\"\/>\n"..doop.."\n") g:close() else selfSay('Error Fale Novamente "pronto"') end elseif msgcontains(msg, 'next') and accstatus == 8 then selfSay('Otimo Sua conta e seu personagem foram criados. Seu Numero de Conta e '..myaccnumber..' e sua senha: '..mypass..'.') selfSay('Pronto, entre no seu personagem para outra pessoa criar conta.') accstatus = 0 elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then selfSay('Tchau, Tchau, ' .. creatureGetName(cid) .. '!') focus = 0 accstatus = 0 myname = '' mypass = '' myaccnumber = 0 seksik = '' talk_start = 0 end end end function onCreatureChangeOutfit(creature) end function onThink() if (os.clock() - talk_start) > 30 then if focus > 0 then selfSay('Próximo...') end focus = 0 end if focus ~= 0 then if getDistanceToCreature(focus) > 5 then selfSay('Tchau, Tchau!') focus = 0 end end end
Postado Julho 3, 2013 13 anos Encontre a linha myaccnumber = math.random(100000,999999) Substitua por essalocal n = tostring(param) myaccnumber = n Att. Giovani Rodrigo
Postado Julho 3, 2013 13 anos Autor Ai velho, até deu certo porem... agora qnd cria uma account o login vem " nil " isso pela primeira vez, na segunda ja n da mais pra criar.. #EU ACHOOO# que é por essas duas linhas.. if io.open("data/players/"..myname..".xml" , "r") == nil then if io.open("data/accounts/"..myaccnumber..".xml" , "r") == nil then # Se for me diga oq eu tenho que editar nessas linhas.. OBRIGADO
Postado Julho 4, 2013 13 anos Estava conversando com um colega meu e achamos que seria melhor você dar um update no seu servidor usando uma versão mais nova, 8.x para ser mais exato. Esses servidores antigos estão sujeitos a bugs e são obsoletos. Outra dica, use um website. A questão da modificação do seu script da Account Manager, teria que ter algo pra dar valor a variável "n" que seria o valor da account name, mas esse script seu esta tão cheio de gambiarra que eu não consigo intender nada.
Postado Julho 5, 2013 13 anos Autor SOKAOSKOSKAOKSA, Varios me falam isso, mais vou continuar com meu 7.81, meu lema é criar algo divertido simples, porem util
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.