Jump to content
Sign in to follow this  
ANTH

Server Stats

Recommended Posts

Hi

I would like some help on getting server scores transfer to update on to webpage, Kills, Deaths, thats sort of thing just wondering if any one knows how to do it. My goal is to track every single server for this. But need some help doing it.

Can anyone help?

Share this post


Link to post
Share on other sites

I tried to write a perl cgi to do that once, but didn't really finish it. I didn't link to it from the site as it is not yet finished, but you can see the how it looks like at our site. The core part looks like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#! /usr/bin/perl -w

use strict;

use IO::Socket;

use CGI::Carp qw(fatalsToBrowser);

#default values if no parameters are given

my $ARGS_HOSTNAME = 'gdt.game-server.cc';

#queryport defaults to serverport+1

my $ARGS_PORT = '2303';

#holds the response packet and is later used as loop variable for output

my $response="bla";

#will hold output data in key/value format

my %ausgabe;

#holder for stripping off leading slash in response ticket and used as loop

my $holder=0;

#open socket

my $sock = new IO::Socket::INET (

PeerAddr => $ARGS_HOSTNAME,

PeerPort => $ARGS_PORT,

Proto => 'udp',

Blocking => 1,

);

die "Could not create socket: $!\n" unless $sock;

$sock->autoflush(1);

$sock->syswrite("\\status\\");

#data length of 8192 bytes should be enough for about 150 players

if ($sock->sysread($response,8192))

{

#split off first slash in answer packet

($holder,%ausgabe)= split /\\/,$response;

} else {

print "Server $ARGS_HOSTNAME:$ARGS_PORT is down";

}

Share this post


Link to post
Share on other sites

looks complicated im not fimliar with pearl :S. But im a very good learner when it comes to computers. I will give it ago.

Share this post


Link to post
Share on other sites

Moving to MP.

And ANTH your sig image exceeds the rules, expect a PM smile_o.gif

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×