搜索
楼主: skyforever

【发布】游戏中玩家查看其他服务器状态(中)

[复制链接]
发表于 2006-5-11 23:59:58 | 显示全部楼层 来自 中国–广东–广州

回复: 【发布】游戏中玩家查看其他服务器状态(中)

Post by skyforever
[color="Red"]如何获取ping,通过这个socket的,知道告诉我,就差这了。

其他的,都差不多好了,
求助高手:需要获取ping的socket的发送包,和分析接受包!!!

PS:没什么时间对不同版本数据包研究了,在3329可以获取2834,3329,3382服务器的状态。


ping要自己计算 数据包不返回ping
回复

使用道具 举报

 楼主| 发表于 2006-5-12 00:06:48 | 显示全部楼层 来自 中国–福建–泉州–永春县

回复: 【发布】游戏中玩家查看其他服务器状态(中)

Post by ahcat
ping要自己计算 数据包不返回ping


能详细点么,3q,急呀,差那么点呀。
回复

使用道具 举报

发表于 2006-5-12 00:11:11 | 显示全部楼层 来自 中国–广东–广州

回复: 【发布】游戏中玩家查看其他服务器状态(中)

记下发送数据包和返回数据包之间的时间差值,就是你的ping值。
回复

使用道具 举报

发表于 2006-5-12 04:17:35 | 显示全部楼层 来自 中国–广西–玉林

回复: 【发布】游戏中玩家查看其他服务器状态(中)

如果我不修改serverlist.cfg内容
你也可以利用 motd.txt 的显示方式来显示``

比如我输入 say /Servers 呼出菜单

然后把自己喜欢的IP打上去~MOTD就会显示服务器的状态?
回复

使用道具 举报

 楼主| 发表于 2006-5-12 07:11:00 | 显示全部楼层 来自 中国–福建–泉州–永春县

回复: 【发布】游戏中玩家查看其他服务器状态(中)

Post by 解脱
如果我不修改serverlist.cfg内容
你也可以利用 motd.txt 的显示方式来显示``

比如我输入 say /Servers 呼出菜单

然后把自己喜欢的IP打上去~MOTD就会显示服务器的状态?


motd无法实现服务器间跳转呀,所以是菜单形式的。
===========
大大,知道如何获取ping么,你汉化过hlsw应该知道点hlsw获取ping的的方法吧
回复

使用道具 举报

发表于 2006-5-12 07:20:37 | 显示全部楼层 来自 中国–广东–广州

回复: 【发布】游戏中玩家查看其他服务器状态(中)

Post by skyforever
motd无法实现服务器间跳转呀,所以是菜单形式的。
===========
大大,知道如何获取ping么,你汉化过hlsw应该知道点hlsw获取ping的的方法吧


不是说了是自己计算的么。。。。
回复

使用道具 举报

 楼主| 发表于 2006-5-12 07:36:16 | 显示全部楼层 来自 中国–福建–泉州–永春县

回复: 【发布】游戏中玩家查看其他服务器状态(中)

Post by ahcat
不是说了是自己计算的么。。。。


yam给我的资料里面显示有可以获取ping的,好像

  1. ------------------------------
  2. Revised 1/3/2001 ywb -- Added new rcon protocol info:
  3. Note to those writing remote admin programs that issue rcon commands (the in-client rcon commands work as before), you will need to change your rcon tools to use the following revised protocol.
  4. Remote App sends a UDP packet to the server on the server's port (e.g., 127.0.0.1:27015):
  5. The packet should start with 4 consecutive bytes of 255 (32-bit integer -1) and the string:
  6. "challenge rcon\n".
  7. The server will respond to the requesting system on the purported remote IP address and port with four 255's and:
  8. "challenge rcon number\n" where number is an unsigned int32 number.
  9. To issue the actual rcon, the remote App then responds with a UDP packet containing 4 255s and:
  10. "rcon number "password" rconcommands" where password is the rcon_password ( should be enclosed in quotes as noted so that multiple word passwords will continue to work ), number is the unsigned int32 number received from the server and rconcommands is the actual rcon command string.
  11. If the remote App fails to send the appropriate challenge number, waits too long to send the challenge, or uses an invalid password more than a few times in the course of a few seconds, the remote App will be assumed to be malicious and the actual ip address used by the remote host will be permanently and automatically banned from the server (as with the addip command).  You can use listip to see the list of banned ip addresses on a server.

  12. -----------------------------
  13. Game servers will answer the following messages:
  14. Messages are sent to the server by sending 4 consecutive bytes of 255 (32-bit integer -1) and then the string command followed by a zero byte to terminate it
  15. [color="Red"]"ping"
  16. Server responds with a single byte code ASCII 'j'[/color]
  17. "info"
  18. Server responds with the following packet:
  19. (int32)  -1
  20. (byte)  ASCII 'C' (info response, S2A_INFO)
  21. (string)  net address of server
  22. (string)  name of the host / server
  23. (string)  name of the map
  24. (string)  game directory (i.e. valve/)
  25. (string)  Game description (e.g. "half-life multiplay")
  26. (byte)  active client count
  27. (byte)  maximum clients allowed
  28. (byte)  protocol version (currently 7)
  29. "players"
  30. Server responds with the following packet:
  31. (int32)  -1
  32. (byte)  ASCII 'D' (players response, S2A_PLAYER)
  33. (byte)  active client count
  34. for each active client
  35.   (byte)  client number / index
  36.   (string)  player name
  37.   (int32)  client's frag total
  38.   (float32)  client's total time in-game
  39. "rules"
  40. Server responds with the following packet:
  41. (int32)  -1
  42. (byte)  ASCII 'E' (rules response, S2A_RULES)
  43. (int16)  number of rules
  44. for each rule
  45.   (string)  rule name
  46.   (string)  rule value

  47. -------------------
  48. Master server query protocol:
  49. Sent to master:
  50. (byte)    ASCII 'c' ( A2M_GET_SERVERS )
  51. Response from master:
  52. (int32)  -1
  53. (byte)   ASCII 'd' ( M2A_SERVERS )
  54. (byte)   unused
  55. // This is followed by as many 6 byte ip addresses as will fit in the message.  The master currently feeds about 2K worth of IP address ( 300+ or so ), but we may up that # significantly in the near future.
  56. (4 x byte) ip address
  57. (int16)  port #

  58. The old protocol is still valid, but there is a new, extended protocol:
  59. Here are both the old and new protocols ( the new one is the "details" message ):
  60. "info"
  61. Server responds with the following packet:
  62. (int32)  -1
  63. (byte)  ASCII 'C' (info response, S2A_INFO)
  64. (string)  net address of server
  65. (string)  name of the host / server
  66. (string)  name of the map
  67. (string)  game directory (i.e. valve/)
  68. (string)  Game description (e.g. "half-life multiplay")
  69. (byte)  active client count
  70. (byte)  maximum clients allowed
  71. (byte)  protocol version (currently 37)
  72. "details"
  73. (int32)      -1
  74. (byte)  ASCII 'm' ( S2A_INFO_DETAILED )
  75. (string)  net address of server
  76. (string)  name of the host / server
  77. (string)  name of the map
  78. (string)  game directory (i.e. valve/)
  79. (string)  Game description (e.g. "half-life multiplay")
  80. (byte)  active client count
  81. (byte)  maximum clients allowed
  82. (byte)  protocol version (currently 37)
  83. (byte)  type of server == 'l' for listen or 'd' for dedicated
  84. (byte)  os of server == 'w' for win32 or 'l' for linux
  85. (byte)  password on server == 1 or yes, 0, for no
  86. (byte)  is server running a mod? == 1 for yes, 0 for no
  87. IFF the server is running mod byte was 1:
  88. (string)  URL for mod's "info" website
  89. (string)  URL for mod's download ftp server
  90. (int32)  mod version #
  91. (int32)  mod download size ( in bytes, approx. )
  92. (byte)  is the mod a server side only mod?  1 == yes, 0 == no
  93. (byte)  does this server require you to have a custom client side .dll ( client
复制代码
回复

使用道具 举报

 楼主| 发表于 2006-5-12 07:41:02 | 显示全部楼层 来自 中国–福建–泉州–永春县

回复: 【发布】游戏中玩家查看其他服务器状态(中)

我通过分析访问数据包,也就发现了3个,info,player,rules,就是无法获取ping那个东西,晕哦,
回复

使用道具 举报

发表于 2006-5-12 07:43:37 | 显示全部楼层 来自 中国–广东–广州

回复: 【发布】游戏中玩家查看其他服务器状态(中)

Send:
0000: FF FF FF FF 54 53 6F 75 72 63 65 20 45 6E 67 69
0010: 6E 65 20 51 75 65 72 79 00

Receive:
0000: FF FF FF FF 6D 32 31 38 2E 31 39 32 2E 31 36 34
0010: 2E 34 3A 32 37 30 31 35 00 4D 61 72 73 68 61 6C
0020: 6C 27 73 20 43 53 00 64 65 5F 64 75 73 74 32 00
0030: 63 73 74 72 69 6B 65 00 43 6F 75 6E 74 65 72 2D
0040: 53 74 72 69 6B 65 00 00 04 2F 64 77 00 01 77 77
0050: 77 2E 63 6F 75 6E 74 65 72 2D 73 74 72 69 6B 65
0060: 2E 6E 65 74 00 77 77 77 2E 64 74 2D 63 6C 75 62
0070: 2E 6E 65 74 00 00 01 00 00 00 00 9E F7 0A 00 01
0080: 00 00

Send:
0000: FF FF FF FF 55 84 D7 78 8B

Receive:
0000: FF FF FF FF 44 00

我取了三次包 返回的包都是一样的。。。。
如果ping值不是由服务器发送的话,那么这个想法就没办法实现了。
回复

使用道具 举报

 楼主| 发表于 2006-5-12 07:51:23 | 显示全部楼层 来自 中国–福建–泉州–永春县

回复: 【发布】游戏中玩家查看其他服务器状态(中)

  1. Send:
  2. 0000: FF FF FF FF 54 53 6F 75 72 63 65 20 45 6E 67 69
  3. 0010: 6E 65 20 51 75 65 72 79 00

  4. Receive:
  5. 0000: FF FF FF FF  
复制代码

这个获取服务器名,地址,版本,地图,当前人数,最大人数等【info及details的内容】

  1. Send:
  2. 0000: FF FF FF FF 55 84 D7 78 8B

  3. Receive:
  4. 0000: FF FF FF FF 44 00
复制代码

这个是获取当前服务器的玩家,你这个代码就是没人。hoho
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表