d3mon Posted July 16, 2008 Share Posted July 16, 2008 Hello, Is it Possible to get info of css server ? For example number of players and current map or ping etc ... Thanks for anyhelp if it's possible... No-life of autoit...what could be better ?LAST SCRIPTS WITH AUTO-IT : CLICK HERE Link to comment Share on other sites More sharing options...
FreeFry Posted July 16, 2008 Share Posted July 16, 2008 Yeah, it's possible, look into the UDP functions. I made something similar but for gold src servers(hl1, cs1.6, etc.), if you search for my threads you'll find it(it's old, and probably doesn't work anymore though). Link to comment Share on other sites More sharing options...
d3mon Posted July 16, 2008 Author Share Posted July 16, 2008 Yeah, it's possible, look into the UDP functions. I made something similar but for gold src servers(hl1, cs1.6, etc.), if you search for my threads you'll find it(it's old, and probably doesn't work anymore though).I tried but nothing happend...any suggestions ? No-life of autoit...what could be better ?LAST SCRIPTS WITH AUTO-IT : CLICK HERE Link to comment Share on other sites More sharing options...
FreeFry Posted July 16, 2008 Share Posted July 16, 2008 Google on valve and their developer network(I believe it was on wikipedia), where they have documented the packet format they use, after that it's just to start sending the correct packets, and awaiting an answer. muttley Link to comment Share on other sites More sharing options...
FreeFry Posted July 16, 2008 Share Posted July 16, 2008 I took some time to sit down and make this: expandcollapse popupFunc _SteamNetwork_SourceInfoQuery($svServerAddress, $ivServerPort) Local Const $A2S_INFO = Chr(255) & Chr(255) & Chr(255) & Chr(255) & "TSource Engine Query" & Chr(0) $avOpenSocket = UDPOpen($svServerAddress, $ivServerPort) If $avOpenSocket[0] = -1 Then Return(SetError(1, UDPCloseSocket($avOpenSocket), 0)); Error, could not open socket. Local $ivBytesSent = UDPSend($avOpenSocket, $A2S_INFO) If Not $ivBytesSent Then Return(SetError(2, UDPCloseSocket($avOpenSocket), 0)); Error, no bytes could be sent. Local $bvResponseData, $ivResponseTimer = TimerInit() Do $bvResponseData = UDPRecv($avOpenSocket, 1024) Until $bvResponseData <> "" Or TimerDiff($ivResponseTimer) > 5000 If TimerDiff($ivResponseTimer) > 5000 Then Return(SetError(3, UDPCloseSocket($avOpenSocket), 0)); Timed out while receiving response from server. $bvResponseData = StringTrimLeft($bvResponseData, 10); Remove 0xFFFFFFFF Local $avRet[15] = [0, 0, "", "", "", "", 0, 0, 0, 0, "", 0, 0, ""], $svChar $avRet[0] = Dec(StringLeft($bvResponseData, 2)) ; Type If $avRet[0] <> 73 Then Return(SetError(4, UDPCloseSocket($avOpenSocket), 0)); This is not a Source server. $bvResponseData = StringTrimLeft($bvResponseData, 2) $avRet[1] = Dec(StringLeft($bvResponseData, 2)) ; Version $bvResponseData = StringTrimLeft($bvResponseData, 2) Do $svChar = StringLeft($bvResponseData, 2) $bvResponseData = StringTrimLeft($bvResponseData, 2) If $svChar <> "00" Then $avRet[2] &= Chr(Dec($svChar)) ; Server Name Until $svChar = "00" Do $svChar = StringLeft($bvResponseData, 2) $bvResponseData = StringTrimLeft($bvResponseData, 2) If $svChar <> "00" Then $avRet[3] &= Chr(Dec($svChar)) ; Map Until $svChar = "00" Do $svChar = StringLeft($bvResponseData, 2) $bvResponseData = StringTrimLeft($bvResponseData, 2) If $svChar <> "00" Then $avRet[4] &= Chr(Dec($svChar)) ; Game Directory Until $svChar = "00" Do $svChar = StringLeft($bvResponseData, 2) $bvResponseData = StringTrimLeft($bvResponseData, 2) If $svChar <> "00" Then $avRet[5] &= Chr(Dec($svChar)) ; Game Description Until $svChar = "00" $avRet[6] = Dec(StringReplace(StringLeft($bvResponseData, 4), "00", "")) ; AppID $bvResponseData = StringTrimLeft($bvResponseData, 4) $avRet[7] = Dec(StringLeft($bvResponseData, 2)) ; Number of players $bvResponseData = StringTrimLeft($bvResponseData, 2) $avRet[8] = Dec(StringLeft($bvResponseData, 2)) ; Maximum players $bvResponseData = StringTrimLeft($bvResponseData, 2) $avRet[9] = Dec(StringLeft($bvResponseData, 2)) ; Number of bots $bvResponseData = StringTrimLeft($bvResponseData, 2) $avRet[10] = Chr(Dec(StringLeft($bvResponseData, 2))) ; Server mode(d for dedicated, l for listen, p for SourceTV) $bvResponseData = StringTrimLeft($bvResponseData, 2) $avRet[11] = Chr(Dec(StringLeft($bvResponseData, 2))) ; Operating System $bvResponseData = StringTrimLeft($bvResponseData, 2) $avRet[12] = Dec(StringLeft($bvResponseData, 2)) ; Passworded $bvResponseData = StringTrimLeft($bvResponseData, 2) $avRet[13] = Dec(StringLeft($bvResponseData, 2)) ; Secure $bvResponseData = StringTrimLeft($bvResponseData, 2) Do $svChar = StringLeft($bvResponseData, 2) $bvResponseData = StringTrimLeft($bvResponseData, 2) If $svChar <> "00" Then $avRet[14] &= Chr(Dec($svChar)) ; Game Version Until $svChar = "00" Return(SetError(0, UDPCloseSocket($avOpenSocket), $avRet)) EndFunc You can use it something like this: #include <Array.au3> UDPStartup() $aServerInfo = _SteamNetwork_SourceInfoQuery("193.200.158.148", 27016) If Not @error Then _ArrayDisplay($aServerInfo, "Server Info") EndIf Do note that you need UDPStartup() at the top of your script(or anywhere before you use my function). Link to comment Share on other sites More sharing options...
d3mon Posted July 17, 2008 Author Share Posted July 17, 2008 I took some time to sit down and make this: expandcollapse popupFunc _SteamNetwork_SourceInfoQuery($svServerAddress, $ivServerPort) Local Const $A2S_INFO = Chr(255) & Chr(255) & Chr(255) & Chr(255) & "TSource Engine Query" & Chr(0) $avOpenSocket = UDPOpen($svServerAddress, $ivServerPort) If $avOpenSocket[0] = -1 Then Return(SetError(1, UDPCloseSocket($avOpenSocket), 0)); Error, could not open socket. Local $ivBytesSent = UDPSend($avOpenSocket, $A2S_INFO) If Not $ivBytesSent Then Return(SetError(2, UDPCloseSocket($avOpenSocket), 0)); Error, no bytes could be sent. Local $bvResponseData, $ivResponseTimer = TimerInit() Do $bvResponseData = UDPRecv($avOpenSocket, 1024) Until $bvResponseData <> "" Or TimerDiff($ivResponseTimer) > 5000 If TimerDiff($ivResponseTimer) > 5000 Then Return(SetError(3, UDPCloseSocket($avOpenSocket), 0)); Timed out while receiving response from server. $bvResponseData = StringTrimLeft($bvResponseData, 10); Remove 0xFFFFFFFF Local $avRet[15] = [0, 0, "", "", "", "", 0, 0, 0, 0, "", 0, 0, ""], $svChar $avRet[0] = Dec(StringLeft($bvResponseData, 2)) ; Type If $avRet[0] <> 73 Then Return(SetError(4, UDPCloseSocket($avOpenSocket), 0)); This is not a Source server. $bvResponseData = StringTrimLeft($bvResponseData, 2) $avRet[1] = Dec(StringLeft($bvResponseData, 2)) ; Version $bvResponseData = StringTrimLeft($bvResponseData, 2) Do $svChar = StringLeft($bvResponseData, 2) $bvResponseData = StringTrimLeft($bvResponseData, 2) If $svChar <> "00" Then $avRet[2] &= Chr(Dec($svChar)) ; Server Name Until $svChar = "00" Do $svChar = StringLeft($bvResponseData, 2) $bvResponseData = StringTrimLeft($bvResponseData, 2) If $svChar <> "00" Then $avRet[3] &= Chr(Dec($svChar)) ; Map Until $svChar = "00" Do $svChar = StringLeft($bvResponseData, 2) $bvResponseData = StringTrimLeft($bvResponseData, 2) If $svChar <> "00" Then $avRet[4] &= Chr(Dec($svChar)) ; Game Directory Until $svChar = "00" Do $svChar = StringLeft($bvResponseData, 2) $bvResponseData = StringTrimLeft($bvResponseData, 2) If $svChar <> "00" Then $avRet[5] &= Chr(Dec($svChar)) ; Game Description Until $svChar = "00" $avRet[6] = Dec(StringReplace(StringLeft($bvResponseData, 4), "00", "")); AppID $bvResponseData = StringTrimLeft($bvResponseData, 4) $avRet[7] = Dec(StringLeft($bvResponseData, 2)) ; Number of players $bvResponseData = StringTrimLeft($bvResponseData, 2) $avRet[8] = Dec(StringLeft($bvResponseData, 2)) ; Maximum players $bvResponseData = StringTrimLeft($bvResponseData, 2) $avRet[9] = Dec(StringLeft($bvResponseData, 2)) ; Number of bots $bvResponseData = StringTrimLeft($bvResponseData, 2) $avRet[10] = Chr(Dec(StringLeft($bvResponseData, 2))) ; Server mode(d for dedicated, l for listen, p for SourceTV) $bvResponseData = StringTrimLeft($bvResponseData, 2) $avRet[11] = Chr(Dec(StringLeft($bvResponseData, 2))) ; Operating System $bvResponseData = StringTrimLeft($bvResponseData, 2) $avRet[12] = Dec(StringLeft($bvResponseData, 2)) ; Passworded $bvResponseData = StringTrimLeft($bvResponseData, 2) $avRet[13] = Dec(StringLeft($bvResponseData, 2)) ; Secure $bvResponseData = StringTrimLeft($bvResponseData, 2) Do $svChar = StringLeft($bvResponseData, 2) $bvResponseData = StringTrimLeft($bvResponseData, 2) If $svChar <> "00" Then $avRet[14] &= Chr(Dec($svChar)) ; Game Version Until $svChar = "00" Return(SetError(0, UDPCloseSocket($avOpenSocket), $avRet)) EndFunc You can use it something like this: #include <Array.au3> UDPStartup() $aServerInfo = _SteamNetwork_SourceInfoQuery("193.200.158.148", 27016) If Not @error Then _ArrayDisplay($aServerInfo, "Server Info") EndIf Do note that you need UDPStartup() at the top of your script(or anywhere before you use my function). Yep ! Thank you very much muttley how can I get server info by msgbox ? No-life of autoit...what could be better ?LAST SCRIPTS WITH AUTO-IT : CLICK HERE Link to comment Share on other sites More sharing options...
weaponx Posted July 17, 2008 Share Posted July 17, 2008 Yep ! Thank you very much muttley how can I get server info by msgbox ? You mean you don't want to put forth any effort? The function he posted clearly returns an array... MsgBox(0,"",$array[0]) -or- #include <array.au3> _ArrayDisplay($array) Link to comment Share on other sites More sharing options...
d3mon Posted July 17, 2008 Author Share Posted July 17, 2008 (edited) I know , just the server didn't work so i couldnt get info and the script exit without error... Edited July 19, 2008 by d3mon No-life of autoit...what could be better ?LAST SCRIPTS WITH AUTO-IT : CLICK HERE Link to comment Share on other sites More sharing options...
weaponx Posted July 17, 2008 Share Posted July 17, 2008 No, i don't understand that's all..., anyway thanksThe help file explains it all. Link to comment Share on other sites More sharing options...
FreeFry Posted July 18, 2008 Share Posted July 18, 2008 The help file explains it all.It sure does. muttley Link to comment Share on other sites More sharing options...
d3mon Posted July 19, 2008 Author Share Posted July 19, 2008 (edited) Hello, I have finish tools where you can see infos of 10 CSS Server , Enjoy ! muttleyCSS_Server.au3CSS_Server.au3 Edited July 19, 2008 by d3mon No-life of autoit...what could be better ?LAST SCRIPTS WITH AUTO-IT : CLICK HERE Link to comment Share on other sites More sharing options...
d3mon Posted July 20, 2008 Author Share Posted July 20, 2008 Possibility to get list of players on serveur ? Thanks in advance No-life of autoit...what could be better ?LAST SCRIPTS WITH AUTO-IT : CLICK HERE Link to comment Share on other sites More sharing options...
FreeFry Posted July 21, 2008 Share Posted July 21, 2008 I updated the first function fixed some small stuff, then I added two more functions, _SteamNetwork_SourcePlayersInfoQuery, and _SteamNetwork_SourceGetChallenge, to accompany the _SteamNetwork_SourceInfoQuery function. muttleyYou can use the newly added _SteamNetwork_SourcePlayersInfoQuery function like this:UDPStartup() $avInfo = _SteamNetwork_SourcePlayersInfoQuery("166.70.135.168", 27015) $Players = @extended If @error Or Not IsArray($avInfo) Then ConsoleWrite("Error: " & @error & " Return: " & $avInfo & @LF) Exit Else For $i = 0 To $Players-1 ConsoleWrite("Player: #" & $i+1 & " Index: " & $avInfo[$i][0] & " (" & $avInfo[$i][1] & ")" & @LF & @TAB & "Kills: " & $avInfo[$i][2] & @LF & @TAB & "ConnTime: " & $avInfo[$i][3] & @LF) Next EndIfexpandcollapse popupFunc _SteamNetwork_SourcePlayersInfoQuery($svServerAddress, $ivServerPort, $svChallenge = "") If $svChallenge = "" Then $svChallenge = _SteamNetwork_SourceGetChallenge($svServerAddress, $ivServerPort) If @error Then Return(SetError(@error, 0, -1)); Error from GetChallenge function. EndIf Local $avOpenSocket = UDPOpen($svServerAddress, $ivServerPort) If $avOpenSocket[0] = -1 Then Return(SetError(1, UDPCloseSocket($avOpenSocket), 0)) Local Const $A2S_PLAYER = Chr(255) & Chr(255) & Chr(255) & Chr(255) & Chr(85) & $svChallenge Local $ivBytesSent = UDPSend($avOpenSocket, $A2S_PLAYER) If Not $ivBytesSent Then Return(SetError(2, UDPCloseSocket($avOpenSocket), 0)); Error, no bytes could be sent. Local $bvResponseData, $ivResponseTimer = TimerInit() Do $bvResponseData = UDPRecv($avOpenSocket, 1024, 1) Until $bvResponseData <> "" Or TimerDiff($ivResponseTimer) > 5000 If TimerDiff($ivResponseTimer) > 5000 Then Return(SetError(3, UDPCloseSocket($avOpenSocket), 0)); Timed out while receiving response from server. $bvResponseData = StringTrimLeft($bvResponseData, 10); Remove 0xFFFFFFFF Local $ivType = Dec(StringLeft($bvResponseData, 2)) If $ivType <> 68 Then Return(SetError(4, UDPCloseSocket($avOpenSocket), 0)); This is not a source server. $bvResponseData = StringTrimLeft($bvResponseData, 2) Local $ivNumPlayers = Dec(StringLeft($bvResponseData, 2)) If Not $ivNumPlayers Then Return(SetError(5, $ivNumPlayers, 0)); Semi-error, no players on this server. $bvResponseData = StringTrimLeft($bvResponseData, 2) Local $avRet[$ivNumPlayers][4] For $i = 0 To $ivNumPlayers-1 $avRet[$i][0] = Dec(StringLeft($bvResponseData, 2)) ; Player index $bvResponseData = StringTrimLeft($bvResponseData, 2) Do $svChar = StringLeft($bvResponseData, 2) $bvResponseData = StringTrimLeft($bvResponseData, 2) If $svChar <> "00" Then $avRet[$i][1] &= Chr(Dec($svChar)) ; Player Name Until $svChar = "00" $avRet[$i][2] = StringLeft($bvResponseData, 8) ; Player Kills $bvResponseData = StringTrimLeft($bvResponseData, 8) $avRet[$i][2] = Number(Dec(StringMid($avRet[$i][2], 7, 2)) & Dec(StringMid($avRet[$i][2], 5, 2)) & Dec(StringMid($avRet[$i][2], 3, 2)) & Dec(StringMid($avRet[$i][2], 1, 2))) $avRet[$i][3] = StringLeft($bvResponseData, 8) ; Player Time(connected time, in seconds) $bvResponseData = StringTrimLeft($bvResponseData, 8) $avRet[$i][3] = StringMid($avRet[$i][3], 7, 2) & StringMid($avRet[$i][3], 5, 2) & StringMid($avRet[$i][3], 3, 2) & StringMid($avRet[$i][3], 1, 2) Local $stvFloat = DllStructCreate("int") Local $stvInt = DllStructCreate("float", DllStructGetPtr($stvFloat)) DllStructSetData($stvFloat, 1, Number("0x" & $avret[$i][3])) $avRet[$i][3] = DllStructGetData($stvInt, 1) $stvFloat = 0 $stvInt = 0 Next UDPCloseSocket($avOpenSocket) Return(SetError(0, $ivNumPlayers, $avRet)) EndFunc Func _SteamNetwork_SourceGetChallenge($svServerAddress, $ivServerPort) Local $avOpenSocket = UDPOpen($svServerAddress, $ivServerPort) If $avOpenSocket[0] = -1 Then Return(SetError(1, UDPCloseSocket($avOpenSocket), 0)); Error, could not open socket. Local Const $A2S_SERVERQUERY_GETCHALLENGE = Chr(255) & Chr(255) & Chr(255) & Chr(255) & Chr(87) Local $ivBytesSent = UDPSend($avOpenSocket, $A2S_SERVERQUERY_GETCHALLENGE) If Not $ivBytesSent Then Return(SetError(2, UDPCloseSocket($avOpenSocket), 0)); Error, no bytes could be sent. Local $bvResponseData, $ivResponseTimer = TimerInit() Do $bvResponseData = UDPRecv($avOpenSocket, 1024, 1) Until $bvResponseData <> "" Or TimerDiff($ivResponseTimer) > 5000 If TimerDiff($ivResponseTimer) > 5000 Then Return(SetError(3, UDPCloseSocket($avOpenSocket), 0)); Timed out while receiving response from server. $bvResponseData = StringTrimLeft($bvResponseData, 10); Remove 0xFFFFFFFF Local $ivType = Dec(StringLeft($bvResponseData, 2)) If $ivType <> 65 Then Return(SetError(4, UDPCloseSocket($avOpenSocket), 0)); This is not a source server $bvResponseData = StringTrimLeft($bvResponseData, 2) Local $svChallenge Do $svChallenge &= Chr(Dec(StringLeft($bvResponseData, 2))) $bvResponseData = StringTrimLeft($bvResponseData, 2) Until Not StringLen($bvResponseData) Return(SetError(0, UDPCloseSocket($avOpenSocket), $svChallenge)) EndFunc Func _SteamNetwork_SourceInfoQuery($svServerAddress, $ivServerPort) Local Const $A2S_INFO = Chr(255) & Chr(255) & Chr(255) & Chr(255) & "TSource Engine Query" & Chr(0) $avOpenSocket = UDPOpen($svServerAddress, $ivServerPort) If $avOpenSocket[0] = -1 Then Return(SetError(1, UDPCloseSocket($avOpenSocket), 0)); Error, could not open socket. Local $ivBytesSent = UDPSend($avOpenSocket, $A2S_INFO) If Not $ivBytesSent Then Return(SetError(2, UDPCloseSocket($avOpenSocket), 0)); Error, no bytes could be sent. Local $bvResponseData, $ivResponseTimer = TimerInit() Do $bvResponseData = UDPRecv($avOpenSocket, 1024, 1) Until $bvResponseData <> "" Or TimerDiff($ivResponseTimer) > 5000 If TimerDiff($ivResponseTimer) > 5000 Then Return(SetError(3, UDPCloseSocket($avOpenSocket), 0)); Timed out while receiving response from server. $bvResponseData = StringTrimLeft($bvResponseData, 10); Remove 0xFFFFFFFF Local $avRet[15] = [0, 0, "", "", "", "", 0, 0, 0, 0, "", 0, 0, ""], $svChar $avRet[0] = Dec(StringLeft($bvResponseData, 2)) ; Type If $avRet[0] <> 73 Then Return(SetError(4, UDPCloseSocket($avOpenSocket), 0)); This is not a Source server. $bvResponseData = StringTrimLeft($bvResponseData, 2) $avRet[1] = Dec(StringLeft($bvResponseData, 2)) ; Version $bvResponseData = StringTrimLeft($bvResponseData, 2) Do $svChar = StringLeft($bvResponseData, 2) $bvResponseData = StringTrimLeft($bvResponseData, 2) If $svChar <> "00" Then $avRet[2] &= Chr(Dec($svChar)) ; Server Name Until $svChar = "00" Do $svChar = StringLeft($bvResponseData, 2) $bvResponseData = StringTrimLeft($bvResponseData, 2) If $svChar <> "00" Then $avRet[3] &= Chr(Dec($svChar)) ; Map Until $svChar = "00" Do $svChar = StringLeft($bvResponseData, 2) $bvResponseData = StringTrimLeft($bvResponseData, 2) If $svChar <> "00" Then $avRet[4] &= Chr(Dec($svChar)) ; Game Directory Until $svChar = "00" Do $svChar = StringLeft($bvResponseData, 2) $bvResponseData = StringTrimLeft($bvResponseData, 2) If $svChar <> "00" Then $avRet[5] &= Chr(Dec($svChar)) ; Game Description Until $svChar = "00" $avRet[6] = Dec(StringReplace(StringLeft($bvResponseData, 4), "00", "")) ; AppID $bvResponseData = StringTrimLeft($bvResponseData, 4) $avRet[7] = Dec(StringLeft($bvResponseData, 2)) ; Number of players $bvResponseData = StringTrimLeft($bvResponseData, 2) $avRet[8] = Dec(StringLeft($bvResponseData, 2)) ; Maximum players $bvResponseData = StringTrimLeft($bvResponseData, 2) $avRet[9] = Dec(StringLeft($bvResponseData, 2)) ; Number of bots $bvResponseData = StringTrimLeft($bvResponseData, 2) $avRet[10] = Chr(Dec(StringLeft($bvResponseData, 2))) ; Server mode(d for dedicated, l for listen, p for SourceTV) $bvResponseData = StringTrimLeft($bvResponseData, 2) $avRet[11] = Chr(Dec(StringLeft($bvResponseData, 2))) ; Operating System $bvResponseData = StringTrimLeft($bvResponseData, 2) $avRet[12] = Dec(StringLeft($bvResponseData, 2)) ; Passworded $bvResponseData = StringTrimLeft($bvResponseData, 2) $avRet[13] = Dec(StringLeft($bvResponseData, 2)) ; Secure $bvResponseData = StringTrimLeft($bvResponseData, 2) Do $svChar = StringLeft($bvResponseData, 2) $bvResponseData = StringTrimLeft($bvResponseData, 2) If $svChar <> "00" Then $avRet[14] &= Chr(Dec($svChar)) ; Game Version Until $svChar = "00" Return(SetError(0, UDPCloseSocket($avOpenSocket), $avRet)) EndFunc Link to comment Share on other sites More sharing options...
d3mon Posted July 21, 2008 Author Share Posted July 21, 2008 Thanks I will work on it muttley No-life of autoit...what could be better ?LAST SCRIPTS WITH AUTO-IT : CLICK HERE Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now