Source Query Protocol

Discussion in 'Game Modifications' started by gertjuhh, Oct 7, 2005.

  1. gertjuhh

    gertjuhh Guest

    Does anybody know where to find this?
    I want to make a server status script and a live server watching bot for irc.
    But i need to query code to accomplish either ;)

    Ain't been able to find any of up besides the chages made so that Half-Life would be on the same protocol (atleast that what i think).

    If anyone got an example script in php this would be welcome aswell, if not the query code would be verry much appriciated!

    Thnx in advance.
     
  2. Tee Kyoo Em

    Joined:
    May 19, 2003
    Messages:
    892
    Likes Received:
    0
    I did something similar as an exercise in programming recently. I found the specifications of the protocol for Source Server Queries in the obvious place. Based on this, I was able to add a query feature to an IRC bot that I have written a while ago to learn more about the IRC protocol. I wrote the the query code in C++ and not PHP, though. However, it is pretty straightforward to write code that queries Source servers, if you know how to write network code using UDP sockets. I think you should be able to find example code written in PHP on the Internet that queries Goldsource servers and then, using the specs mentioned above, modify the code to parse the information correctly out of the datagrams.
     
  3. gertjuhh

    gertjuhh Guest

    Thank you verry much for that.
    Got the query bit done now, only got some troubles parsing the results...
    first i tried a challange query and put the result on the end of the players query, never got this working... :s
    Then i tried it with the -1 value and this gets me A result.
    But im having troubles parsing this, is any1 willing to help me a hand with this?
    I would be verry thankfull!
     
  4. Chrysalid

    Chrysalid Newbie

    Joined:
    Jun 13, 2004
    Messages:
    160
    Likes Received:
    0
    I would like to extend my IRC bot with Source Queries too, so anyone know a good page with references?

    EDIT!1 - Just found a library for that purpose, also checked out Valve Editing Resource Center :>
     
  5. gertjuhh

    gertjuhh Guest

    Could you link me up with that aswell please Chrysalid??

    Any help parsing is still welcome btw!
     
  6. Chrysalid

    Chrysalid Newbie

    Joined:
    Jun 13, 2004
    Messages:
    160
    Likes Received:
    0
  7. gertjuhh

    gertjuhh Guest

    shame its not open source and c++
    pretty useless for me now as i want to do it with php
    but thnx for the reply anyway!
     
  8. gertjuhh

    gertjuhh Guest

    found PHP Class

    Found a great class for everyone wanting to use php to query both HL1 and/or HL2 (source) servers.
    Its got all the things you need to query a server, but most importantly (for me that was) its got all the parsing function to make something usefull out of the reply from the server ;)
    serverspy_php4.zip for PHP4 and serverspy_php5.zip for PHP5
    Hope this helps
     

Share This Page