Author Topic: How to get data from trem servers  (Read 5983 times)

ambigioz

  • Posts: 26
  • Turrets: +1/-2
How to get data from trem servers
« on: August 02, 2008, 01:33:17 pm »
Hi to all the forum,
I wanted to create a webpage which shows players with defined nickname,exactly like clans.tremulous.net,
or this one http://tremulous.wyckid.de/.
I have a quite good knowledge of php,i would only need some tutorials / codes to see for give me and idea...(aka Gimme the sources!>:D)
So if someone could help me it would be nice  :)

yah

  • Posts: 1
  • Turrets: +0/-0
Re: How to get data from trem servers
« Reply #1 on: August 02, 2008, 03:19:50 pm »

kevlarman

  • Posts: 2737
  • Turrets: +291/-295
Re: How to get data from trem servers
« Reply #2 on: August 02, 2008, 07:06:35 pm »
send the server '\xff\xff\xff\xffgetstatus' on the port the server is running on (udp), it will respond with '\xff\xff\xff\xffstatusresponse\n' followed by the serverinfo string (\cvar1\value1\cvar2\value2\...\cvarN\valueN\n), followed by the players ("score ping player_name\n"), you can determine their team by the contents of "P" in the serverinfo, it will have a - for an empty slot, a 0 for a spectator, a 1 for an alien and a 2 for the human. (since the player list doesn't include empty slots, you'll need to ignore all the '-'s to get it to line up right). this works for almost every game that started off with the code from any quake engine (though P isn't something to rely on in most other games)
Quote from: Asvarox link=topic=8622.msg169333#msg169333
Ok let's plan it out. Asva, you are nub, go sit on rets, I will build, you two go feed like hell, you go pwn their asses, and everyone else camp in the hallway, roger?
the dretch bites.
-----
|..d| #
|.@.-##
-----

ambigioz

  • Posts: 26
  • Turrets: +1/-2
Re: How to get data from trem servers
« Reply #3 on: August 20, 2008, 12:49:08 pm »
After some troubles i managed to use gameQ,but i haven't well understood how to understand if players are aliens humans or spectators...
Kevlarman do is it possible to understand it with this output?
 
Code: [Select]
Array
(
    [trem] => Array
        (
            [maxPing] => 300
            [pure] => 1
            [sv_maxclients] => 12
            [clients] => 0
            [mapname] => atcs
            [hostname] => ^2I^7nvasion Official server
            [protocol] => 69
            [sv_dlURL] => http://tremulous.1s.fr
            [sv_minRate] => 5000
            [timelimit] => 0
            [sv_hostname] => ^2I^7nvasion Official server
            [sv_maxRate] => 15000
            [sv_minPing] => 0
            [sv_maxPing] => 300
            [g_maxGameClients] => 0
            [g_suddenDeathTime] => 0
            [g_friendlyFire] => 1
            [g_suddenDeathMode] => 2
            [g_friendlyBuildableFire] => 1
            [g_unlagged] => 0
            [g_allowShare] => 1
            [g_invasionStartTime] => 45
            [g_humanSpawnTeleport] => 1
            [g_alienSpawnTeleport] => 1
            [version] => tremulous 1.1.0 linux-x86 Aug 14 2008
            [sv_privateClients] => 12
            [sv_allowDownload] => 1
            [g_speed] => 320
            [g_gravity] => 800
            [g_knockback] => 1000
            [g_humanBuildPoints] => 0
            [g_alienBuildPoints] => 100
            [gamename] => base
            [P] => 111111111111---0022-----
            [ff] => 7
            [qvm_version] => Lakitu7's QVM 5.3 (Aug 14 2008, 23:22:34)
            [g_suddenDeath] => 0
            [g_needpass] => 0
            [g_cheatAdminLevel] => 0
            [players] => Array
                (
                    [0] => Array
                        (
                            [frags] => 1
                            [ping] => 81
                            [nick] => ^4=[-^7AS^1-]=^5DL21
                        )

                    [1] => Array
                        (
                            [frags] => 1
                            [ping] => 83
                            [nick] => ^3.:!^5TE^3!:.^2anihilator
                        )

                    [2] => Array
                        (
                            [frags] => 7
                            [ping] => 89
                            [nick] => ^5Z^7omg^4er
                        )

                    [3] => Array
                        (
                            [frags] => 1
                            [ping] => 103
                            [nick] => ^4=[-^7AS^1-]=^5Driv3r
                        )

                )

            [gq_online] => 1
            [gq_address] => 89.85.66.29
            [gq_port] => 30720
            [gq_prot] => quake3
            [gq_type] => tremulous
        )

)

kevlarman

  • Posts: 2737
  • Turrets: +291/-295
Re: How to get data from trem servers
« Reply #4 on: August 21, 2008, 01:23:12 am »
Code: [Select]
Array
(
    [trem] => Array
        (
                  ...
                  [sv_privateClients] => 12
                  ...
            [P] => 111111111111---0022-----
                  ...
            [players] => Array
                (
                    [0] => Array
                        (
                            [frags] => 1
                            [ping] => 81
                            [nick] => ^4=[-^7AS^1-]=^5DL21
                        )

                    [1] => Array
                        (
                            [frags] => 1
                            [ping] => 83
                            [nick] => ^3.:!^5TE^3!:.^2anihilator
                        )

                    [2] => Array
                        (
                            [frags] => 7
                            [ping] => 89
                            [nick] => ^5Z^7omg^4er
                        )

                    [3] => Array
                        (
                            [frags] => 1
                            [ping] => 103
                            [nick] => ^4=[-^7AS^1-]=^5Driv3r
                        )

                )
            ....
        )

)
for each slot P will contain a one of:
a - for an empty slot
a 0 for a spectator
a 1 for an alien
a 2 for a human
the first character corresponds to slot 0, the second to slot 1, etc. the playerlist you get from the server will be in the same order, but it won't contain an empty spot if there is no player in that slot. the playerlist also doesn't include players in private slots, so you'll have to skip the first sv_privateclients characters of P.
Quote from: Asvarox link=topic=8622.msg169333#msg169333
Ok let's plan it out. Asva, you are nub, go sit on rets, I will build, you two go feed like hell, you go pwn their asses, and everyone else camp in the hallway, roger?
the dretch bites.
-----
|..d| #
|.@.-##
-----

ambigioz

  • Posts: 26
  • Turrets: +1/-2
Re: How to get data from trem servers
« Reply #5 on: August 21, 2008, 10:42:50 am »
Oh thanks i have understood !  :D

ambigioz

  • Posts: 26
  • Turrets: +1/-2
Re: How to get data from trem servers
« Reply #6 on: August 22, 2008, 08:29:48 am »
sorry for double post,but altought i'm only a newbie with programmation languages,i have some problem to match the number (0,1,2) with the players ... isn't there any source which i could see? :angel:

kevlarman

  • Posts: 2737
  • Turrets: +291/-295
Re: How to get data from trem servers
« Reply #7 on: August 23, 2008, 03:06:05 am »
here is the page that tjw used to use on his server (back when it was still running :'()
Quote from: Asvarox link=topic=8622.msg169333#msg169333
Ok let's plan it out. Asva, you are nub, go sit on rets, I will build, you two go feed like hell, you go pwn their asses, and everyone else camp in the hallway, roger?
the dretch bites.
-----
|..d| #
|.@.-##
-----