Mock 32 #1 Posted December 7, 2009 (edited) Eu fiz essa função so zuando mesmo ela ve se um server esta online e se tiver tras as informações em uma tabela. function getOtservInfo(ip,port) --- function by mock local conect = socket.connect(ip,port) if conect then conect:send(string.char(0x06,0x00,0xff,0xff)..'info') local _,status,b = conect:receive(1024) conect:close() if b and b ~= '' then info = { name = b:match('servername="(.-)"'), location = b:match('location="(.-)"'), site = b:match('url="(.-)"'), server = b:match('server="(.-)"'), server_version = b:match('version="(.-)"'), client = b:match('client="(.-)"'), online = b:match('online="(.-)"'), omax = b:match('max="(.-)"'), peak = b:match('peak="(.-)"'), motd = b:match('<motd>(.+)</motd>'), xml = b, } return info end else return nil end end na tabela eu nao coloquei todas as informaçoes mais a maioria tem, ainda coloquei pra retornar o XML que ele envia pra vc. mais se quiser pode mudar. auqi é um exemplo de um XML retornado por um otserv. <?xml version="1.0"?> <tsqp version="1.0"><serverinfo uptime="123" ip="localhost" servername="qq" port="7171" location="nemsei" url="otnet" server="tfs" version="0.2" client="8.12"/><owner name="www.com.br" email="[email protected]"/><players online="73" max="200" peak="203"/><monsters total="4664"/><map name="map" author="ADM" width="3456" height="4078"/> <motd> ririrairariairaari </motd> </tsqp> Edited January 23, 2011 by Mickfern Share this post Link to post Share on other sites
matheusmacena 0 #2 Posted December 13, 2009 hmm, não entendi bem da pra explicar so meio novo Share this post Link to post Share on other sites
god guizao 0 #3 Posted December 20, 2009 Pois é, tbm não entendi direito Share this post Link to post Share on other sites
Mock 32 #4 Posted December 20, 2009 gente isso aki n é conteudo pra iniciantes em scripting nao :S Share this post Link to post Share on other sites
EcL 3 #5 Posted December 21, 2009 /\ [mockseachandomodeon/] Ficou altus do pode cre mano, nem da pra acredita no que tu faz em lua *.* Share this post Link to post Share on other sites
Marley_ 0 #6 Posted January 2, 2010 pra qe serve isso Share this post Link to post Share on other sites
Mock 32 #7 Posted January 4, 2010 @Marley_ ler o topico ajuda viu? nao o topico mais o nome do topico :coolface: Share this post Link to post Share on other sites
Mock 32 #8 Posted January 4, 2010 @Marley_ ler o topico ajuda viu? nao o topico mais o nome do topico :coolface: Share this post Link to post Share on other sites
Conde2 0 #9 Posted January 5, 2010 Vlw mock muito bom XD Ruim que se for utilizar em servidor vai precisar da otal =s Mais se for utilizar no Scite tem problema nao xD Ow como vc descobriu os numeros que se tem que pedir pro servidor responder o que vc quer? Fiquei intrigado com isso =O Share this post Link to post Share on other sites
Mock 32 #10 Posted January 13, 2010 @[V]Conde2 otfans amigo eu 1º vi la depois eu vi no otchecker em PHP Share this post Link to post Share on other sites
Mock 32 #11 Posted January 13, 2010 @[V]Conde2 otfans amigo eu 1º vi la depois eu vi no otchecker em PHP Share this post Link to post Share on other sites
GDLib 2 #12 Posted February 11, 2010 Só uma coisa: o protocolo do OpenTibia envia dados na forma binária, que é muito mais rápido. Deixe o XML para newbies ;D Share this post Link to post Share on other sites
Mock 32 #13 Posted February 11, 2010 (edited) Sim nostra, eu fiquei curioso hoje demanhã para saber como era o protocol do tibia ai criei isso: require('socket') local skt = socket.bind('*',7171) local tibia = skt:accept() repeat s,b = tibia:receive(10) print(s) until b == 'closed' print('closed') e ele retornou isso: • ª,K‡,KÓ ÃåJˆ©Ð¢ý”œ G£5ôF›´`ÖÇ d†|¹²´šd® Ú£U¹Ë»Ò™* ãW>3õ8®Å ¬Ò‡ß£bõ(ãV £” ʰ|LÒf mT ß t¼ Ј…âëU¿Ã c¾šìˆðVuõ1 ÞÈ–9ªââàŒé ž}kô¡ƒ ì6 éuÁ[‡:ˆÒ Edited January 23, 2011 by Mickfern Share this post Link to post Share on other sites
GDLib 2 #14 Posted February 11, 2010 Veja a classe de status do POT, mas você terá de entender um pouco de PHP. Share this post Link to post Share on other sites