i want to wrire simple python script for server status. Looking for api, some doc or anything what could help me.
This is my bash shell script to display the raw Quake3 server information: fetch-serverinfo
I’ll explain the quake 3 server status protocol but it’s up to you to figure out how to implement it using Python.
Different information is obtained from both getinfo and getstatus requests so applications often have to request both (using separate packets). Note however that gamename is different between them; gamename in infoResponse is name for dpmaster protocol but in statusReponse it’s set by mod (qagame.qvm) to mod directory.
Send a UDP packet containing “\xFF\xFF\xFF\xFFgetinfo xxx” (where \xFF is a byte with value 255 and xxx can be a random challenge text) to a server (usually port 27960). The server will reply with “\xFF\xFF\xFF\xFFinfoResponse\n” (where \xFF is a byte with value 255 and \n is a newline character) followed by a Q3 info string (key and value pairs separated by a backslash).
Example infoResponse from
\xFF\xFF\xFF\xFFinfoResponse \voip\opus\g_needpass\0\pure\0\gametype\0\sv_maxclients\16\g_humanplayers\0\clients\2\mapname\q3dm7\hostname\server.ioquake3.org ioquake3 official\protocol\68\gamename\Quake3Arena\challenge\xxx
Send a UDP packet containing “\xFF\xFF\xFF\xFFgetstatus xxx” to a server (usually port 27960). The server will reply with “\xFF\xFF\xFF\xFFstatusResponse\n” followed by a Q3 info string and player information on separate lines (score ping “name”). Ping 0 is either a bot or local player on a non-dedicated server.
\xFF\xFF\xFF\xFFstatusResponse \challenge\xxx\sv_allowDownload\1\sv_dlURL\http:\dmflags\0\fraglimit\25\timelimit\30\sv_hostname\server.ioquake3.org ioquake3 official\sv_maxclients\16\sv_minRate\0\sv_maxRate\10000\sv_dlRate\100\sv_minPing\0\sv_maxPing\0\sv_floodProtect\1\g_maxGameClients\0\capturelimit\8\version\ioq3 1.36_GIT_60a3112-2018-05-14 linux-x86_64 May 14 2018\com_gamename\Quake3Arena\com_protocol\71\g_gametype\0\mapname\q3dm7\sv_privateClients\0\bot_minplayers\2\gamename\baseq3\g_needpass\0 11 0 "Visor" 8 0 "Biker"
Thx a lot man
I understand there are many ways to skin a cat, I just wanted to mention an old tool, qstat. Now that I’ve mentioned it, I’ll have to try it again myself - done, some output below. Qstat is a command line tool, and I’d be lying if I said I knew what code it was written in. In the past I had to compile it for the server I was running, but tonight I just used apt to install on my ubuntu server.
You can find the “current version” at GitHub: https://github.com/multiplay/qstat
Examples of output:
This was a COD4 server so I used
$ quakestat -P -q3s 184.108.40.206:28960|pastebinit
It’s been a while, I have to look for my old data to see how I used to include the output to a web page. I have also used the output to modules in Vbulletin Modules. Since I quit everything about 10 years back, I’m just dabbling in memories. In the end, your pursuit of a python solution may server you better. Good luck! Post something when you are done, it might look better than what I’ve seen!