• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Server Status for Multiworld

Arakos

New Member
Joined
Sep 2, 2008
Messages
26
Reaction score
0
Hello.
If someone could make status server for website with using multiworld system that it will sum players in world with id 0 and 1, I will be very thankful.

Example: Server 1 has 100 players online and second 225 so server status will be "Players online: 325"

In layout.php I have:
Code:
<?php			
if($config['status']['serverStatus_online'] == 1)
				echo '<p>Status:<b><font color="#00FF00"> Online</font></b><br />Online: '.$config['status']['serverStatus_players'].' / '.$config['status']['serverStatus_playersMax'].'<br />Uptime: '.$config['status']['serverStatus_uptime'].'';
			else
				echo '<font color="red"><b> Server OFFLINE</b></font>';
echo '<a href="index.php?subtopic=whoisonline"><div class="newtekst">Players Online</div></a>';
 
?>

And it needs to edit function in config-functions.php file:
Code:
$config['status'] = parse_ini_file('config/serverstatus');
if($config['status']['serverStatus_lastCheck']+$statustimeout < time())
{
	$config['status']['serverStatus_checkInterval'] = $statustimeout+3;
	$config['status']['serverStatus_lastCheck'] = time();
	$info = chr(6).chr(0).chr(255).chr(255).'info';
	$sock = @fsockopen("127.0.0.1", $config['server']['port'], $errno, $errstr, 1);
	if ($sock)
	{
		fwrite($sock, $info); 
		$data=''; 
		while (!feof($sock))
			$data .= fgets($sock, 1024);
		fclose($sock);
		preg_match('/players online="(\d+)" max="(\d+)"/', $data, $matches);
		$config['status']['serverStatus_online'] = 1;
		$config['status']['serverStatus_players'] = $matches[1];
		$config['status']['serverStatus_playersMax'] = $matches[2];
		preg_match('/uptime="(\d+)"/', $data, $matches);
		$h = floor($matches[1] / 3600);
		$m = floor(($matches[1] - $h*3600) / 60);
		$config['status']['serverStatus_uptime'] = $h.'h '.$m.'m';
		preg_match('/monsters total="(\d+)"/', $data, $matches);
		$config['status']['serverStatus_monsters'] = $matches[1];
	}
	else
	{
		$config['status']['serverStatus_online'] = 0;
		$config['status']['serverStatus_players'] = 0;
		$config['status']['serverStatus_playersMax'] = 0;
	}
	$file = fopen("config/serverstatus", "w");
	foreach($config['status'] as $param => $data)

If someone know how to make whole numbers of players in 2 worlds please post it here.

Thanks!
 
I send a guy a script for it once (mine from realms) and he said he should release it. Dunno if it ever happend tho.
 
Back
Top