Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server > CO2 PServer Guides & Releases
You last visited: Today at 23:16

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Release] Online counter (Works for every server)

Discussion on [Release] Online counter (Works for every server) within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old   #1
 
_Emme_'s Avatar
 
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,162
[Release] Online counter (Works for every server)

A very simple onlinecounter written in C#. Generates a txt-file with the amount of TCP-connections connected on port 5816.

Works better than the netstat tool that some binary servers has been using. Has been tested on a binary server with ~100 online and didn't cause any lag or bugs what so ever.


Note: If you run your server and are NOT using binaries, do not use this. Rather create an online-field in your user table and do a SQL-query from there.

This must be run on the VPS/Dedicated server, in the Appserv/root directory (e.g where your web stuff are).


For you that just wants to see the source, here's the "magic" behind it all.
You can also download the source.
Code:
static void CountConnections(object sender, ElapsedEventArgs e)
{
    var connections = from info in                      
         IPGlobalProperties.GetIPGlobalProperties().GetActiveTcpConnections()
         where info.LocalEndPoint.Port == GAME_IP
         select info;
    String Count = connections.Count().ToString();
}
Just open config.txt and fill out the settings (Servername, GameIP and Interval - how often it should update)


To read the result with PHP:

Code:
function OnlinePlayers(){
	if ($fp = fopen('http://your_ip/onlineCount.txt', 'r')) 
	{
		$head = array_change_key_case(get_headers("http://your_ip/onlineCount.txt", TRUE));
		$filesize = $head['content-length'];
		$response = fread($fp, $filesize);
		
		fclose($fp);
		return $response;
	}
}

Enjoy.
Attached Files
File Type: rar Executables.rar (4.4 KB, 24 views)
File Type: rar Source.rar (4.2 KB, 30 views)
_Emme_ is offline  
Thanks
1 User
Old 07/11/2013, 13:45   #2
 
_Emme_'s Avatar
 
elite*gold: 1142
Join Date: Aug 2006
Posts: 2,464
Received Thanks: 1,162
Got some PMs about how to implement this, it's pretty straight forward. If you have any questions ask them in the thread.
_Emme_ is offline  
Reply


Similar Threads Similar Threads
RF ONLINE BlackNows PvP [Private Server] Dami Pinoy Works with Globe Bug and HSS VPN
02/03/2014 - RF Online - 27 Replies
http://i49.tinypic.com/nq2xx.jpg http://i48.tinypic.com/2e36gbr.png IGN: GM
Counter Strike Source Dedicated Server|ONLINE PORT
05/19/2011 - Counter-Strike - 9 Replies
Hallo EPVP, und zwar hab ich ein problem. Wenn ich mir einen Dedicated Server erstelle funktioniert alles PRIMA aber wenn ich denn Online machen will also Port freigabe funktioniert das mit meiner Fritz.Box 7141 nicht???? Weiss vllt einer wie das geht per TV6. Oder mir ein Tipp geben. Freu mich auf eure Antworten. DANKE IM VORRAUS!!!!



All times are GMT +1. The time now is 23:16.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.