ASECO plugin: ServerStats with graph output
Moderators: Flo, f*ckfish, Assembler Maniac, TM-Patrol
ASECO plugin: ServerStats with graph output
I have created my first ASECO plugin, and, now that it has reached a working state, I wanted to share it with you all.
Version 0.5 has been released, get it here
http://gaming.gladblad.dk/aseco/serverstats/
Check post below for information about what has changed.
Version 0.5 has been released, get it here
http://gaming.gladblad.dk/aseco/serverstats/
Check post below for information about what has changed.
Last edited by FlyveHest on 23 May 2008 07:13, edited 2 times in total.
- lgrfbs-sweden
- smooth traffic navigator
- Posts: 200
- Joined: 15 Apr 2007 15:48
- Owned TM-games: TMN
- Location: Sweden
- Contact:
Re: ASECO plugin: ServerStats (Playercount)
Good work!
But I allraedy have the diagram, look here. Gray line is my playercont.
But I have not so many players then I write this post
------------------------------------------------------------------------------------------v
But I allraedy have the diagram, look here. Gray line is my playercont.
But I have not so many players then I write this post

------------------------------------------------------------------------------------------v
Re: ASECO plugin: ServerStats (Playercount)
Whew, I brewed together a small graph, that at the moment only runs on a standard PHP page, but I will try and merge it with the plugin tomorrow (after cleaning up the code a bit also)
But, here's the live-stats from our [GB] TM server, by way of the ServerStats plugin

(Don't know if phpBB actually caches the pic or not, but time will tell
)
But, here's the live-stats from our [GB] TM server, by way of the ServerStats plugin
(Don't know if phpBB actually caches the pic or not, but time will tell

- lgrfbs-sweden
- smooth traffic navigator
- Posts: 200
- Joined: 15 Apr 2007 15:48
- Owned TM-games: TMN
- Location: Sweden
- Contact:
Re: ASECO plugin: ServerStats (Playercount)
Nice graph you done!
Good work.
Good work.
Re: ASECO plugin: ServerStats (Playercount)
Wow ! Let us know when you have realized this graph ! I'm very interested !!
- J-S
- happy cruiser
- Posts: 149
- Joined: 24 Apr 2008 18:20
- Owned TM-games: TMN,TMUF,TMO,TMS
- Manialink(s): shark
- Location: Grenoble - France
- Contact:
Re: ASECO plugin: ServerStats (Playercount)
Thanks for this plugin, it's very interesting for popular server
Re: ASECO plugin: ServerStats (Playercount)
I've added a bunch of features, which includes the ability to output a graph to a PNG file.
But its late now, so, I will be releasing the next version tomorrow, monday.
But its late now, so, I will be releasing the next version tomorrow, monday.

Re: ASECO plugin: ServerStats (Playercount)
Great ! I'll try it ASAP!
-
- sunday driver
- Posts: 71
- Joined: 03 Aug 2007 09:31
- Owned TM-games: TMN, TMS
- Location: Norway
Re: ASECO plugin: ServerStats (Playercount)
Error. Running Win XP SP2 with Xampp, TMNF server and XAseco 0.97.
Code: Select all
# initialize XASECO ############################################################
[XAseco] PHP Version is 5.2.5
[XAseco] Load settings [config.xml]
[XAseco] Load admin/ops lists [adminops.xml]
[XAseco] Load plugin [plugin.localdatabase.php]
[XAseco] Load plugin [plugin.serverstats.php]
Fatal error: Class 'Plugin' not found in C:\TmFServer\xaseco_097_1\plugins\plugi
n.serverstats.php on line 8
- w1lla
- TM-Patrol
- Posts: 1466
- Joined: 23 May 2007 07:20
- Owned TM-games: TMU, TMN, TMF
- Manialink(s): intr
- Location: Venray
Re: ASECO plugin: ServerStats (Playercount)
you can only use it on aseco v 2.1.x version so but maybe someone can edit to xaseco.
Code: Select all
tmnforever is nations and united makes it special. tmnforever has united. I need united!
Re: ASECO plugin: ServerStats (Playercount)
Yes, its only Aseco right now, I haven't used XAseco, so I can't tell if its easy to make an XAseco version or not.w1lla wrote:you can only use it on aseco v 2.1.x version so but maybe someone can edit to xaseco.
- w1lla
- TM-Patrol
- Posts: 1466
- Joined: 23 May 2007 07:20
- Owned TM-games: TMU, TMN, TMF
- Manialink(s): intr
- Location: Venray
Re: ASECO plugin: ServerStats (Playercount)
i tried but i keep to get the same error
playercount doesnt get filled in.
playercount doesnt get filled in.
Code: Select all
tmnforever is nations and united makes it special. tmnforever has united. I need united!
- w1lla
- TM-Patrol
- Posts: 1466
- Joined: 23 May 2007 07:20
- Owned TM-games: TMU, TMN, TMF
- Manialink(s): intr
- Location: Venray
Re: ASECO plugin: ServerStats (Playercount)
Code: Select all
<?php
/*
Requires: SimpleXML library
PHP inspired by FufiWidgets and RASP
*/
Aseco::registerEvent('onStartup', 'initServerStats');
Aseco::registerEvent('onPlayerConnect', 'logServerStats');
Aseco::registerEvent('onPlayerDisconnect', 'cleanupStats');
// Initializes the plugin
function initServerStats()
{
// Load settings
print('[ServerStats] Initializing..');
$Settings = array();
$settingsXML = simplexml_load_file('serverstats.xml');
$Settings["EntriesPrHour"] = intval($settingsXML->entriesprhour);
$Settings["RetentionTime"] = intval($settingsXML->retentiontime);
$Settings["VerboseLogging"] = intval($settingsXML->verboselogging);
// Sanitycheck, no values below 0 and no more than 60 entries pr. hour
if ($Settings["EntriesPrHour"] <= 0) { $Settings["EntriesPrHour"] = 1; }
if ($Settings["EntriesPrHour"] > 60) { $Settings["EntriesPrHour"] = 60; }
// Calculate how often we need to log a datapoint
$Settings["LoggingInterval"] = (round(60 / $Settings["EntriesPrHour"]) * 60);
if ($Settings["VerboseLogging"] = 1) { print('[ServerStats] Logging every '.$Settings["LoggingInterval"].' seconds');}
// Checks MySQL for existance of our logging table
if ($Settings["VerboseLogging"] = 1) { print('[ServerStats] Checking MySQL'); }
$sql = "CREATE TABLE IF NOT EXISTS `serverstats` (
`EntryTime` datetime NOT NULL,
`PlayerCount` smallint(6) NOT NULL default '0',
PRIMARY KEY (`EntryTime`)
) ENGINE=MyISAM";
$sqlresult = mysql_query($sql);
// We will force an update the very first time the mainloop is run
$Settings["LastUpdateTime"] = 1;
}
// Logs a new entry in the stats table
function logServerStats()
{
// Check if its time to update
if (($Settings["LastUpdateTime"] + $Settings["LoggingInterval"]) < time())
{
// It is time to update the stats
if ($Settings["VerboseLogging"] == 1) { print('[ServerStats] Writing datapoint'); }
// Perform the logging SQL
$sql = "INSERT INTO `serverstats` (`EntryTime`, `PlayerCount`) VALUES (DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:00'), ".count($aseco->server->player->playerlist);
$sql = "INSERT INTO `serverstats` (`EntryTime`, `PlayerCount`) VALUES (DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:00'), " & "6" ;
$sqlresult = mysql_query($sql);
// Set the last updated time
$Settings["LastUpdateTime"] = time();
}
}
// Cleans up old records in the stats
function cleanupStats()
{
if ($Settings["VerboseLogging"] = 1) { print('[ServerStats] Cleaning out old datapoints'); }
// Perform the cleanup SQL
$sql = "DELETE FROM `serverstats` WHERE EntryTime < DATE_SUB(NOW(), INTERVAL ".$Settings ." HOUR)";;
$sqlresult = mysql_query($sql);
}
?>
Code: Select all
tmnforever is nations and united makes it special. tmnforever has united. I need united!
Re: ASECO plugin: ServerStats (Playercount)
Wait for later today, i'll release 0.5 with a lot of new additions.w1lla wrote: all ready made a start for xaseco.
- J-S
- happy cruiser
- Posts: 149
- Joined: 24 Apr 2008 18:20
- Owned TM-games: TMN,TMUF,TMO,TMS
- Manialink(s): shark
- Location: Grenoble - France
- Contact:
Re: ASECO plugin: ServerStats (Playercount)
Thanks FlyveHest ! Your plugin is very usefull