TomCrusher
Jeg er ingenting
Hello, I'm nevbie in the php scripting but I maked some modifications on Gesior Accmaker and I have summary status under monster pedestal from two servers.
You can check on:
Fire-Magma OTS Who is online?
So begin>>>
1. First open your www/config/config.ini file and change to:
2. Next into this folder www/config/ copy "serverstatus" file and rename it to "serverstatus1"
3.Go to www folder and find config-and-function.php open it and replace:
after in the same file find and replace:
4. End last modification in www/layouts/tibiacom/layout.php find and replace:
And DONE...
If have you another idea only post here, this modifications work for me. :thumbup:
You can check on:
Fire-Magma OTS Who is online?
So begin>>>
1. First open your www/config/config.ini file and change to:
PHP:
install = "no"
server_path = "first server"
server_path1 = "second server"
signatures = "1"
2. Next into this folder www/config/ copy "serverstatus" file and rename it to "serverstatus1"
3.Go to www folder and find config-and-function.php open it and replace:
PHP:
//load server config
$config['server'] = parse_ini_file($config['site']['server_path'].'config.lua');
$config['server1'] = parse_ini_file($config['site']['server_path1'].'config.lua');
after in the same file find and replace:
PHP:
//set monster of week
function logo_monster() {
return str_replace(" ", "", trim(mb_strtolower($GLOBALS['layout_ini']['logo_monster'])));
}
$statustimeout = 1;
foreach(explode("*", str_replace(" ", "", $config['server']['statusTimeout'])) as $status_var)
if($status_var > 0)
$statustimeout = $statustimeout * $status_var;
$statustimeout = $statustimeout / 1000;
$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.0", $config['server']['statusPort'], $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)
{
$file_data .= $param.' = "'.str_replace('"', '', $data).'"
';
}
rewind($file);
fwrite($file, $file_data);
fclose($file);
// do server file 2
$status1timeout = 1;
foreach(explode("*", str_replace(" ", "", $config['server1']['statusTimeout'])) as $status1_var)
if($status1_var > 0)
$status1timeout = $status1timeout * $status1_var;
$status1timeout = $status1timeout / 500;
$config['status1'] = parse_ini_file('config/serverstatus1');
if($config['status1']['serverStatus1_lastCheck']+$status1timeout < time())
{
$config['status1']['serverStatus1_checkInterval'] = $status1timeout+3;
$config['status1']['serverStatus1_lastCheck'] = time();
$info = chr(6).chr(0).chr(255).chr(255).'info';
$sock = @fsockopen("127.0.0.0", $config['server1']['statusPort'], $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['status1']['serverStatus1_online'] = 1;
$config['status1']['serverStatus1_players'] = $matches[1];
$config['status1']['serverStatus1_playersMax'] = $matches[2];
preg_match('/uptime="(\d+)"/', $data, $matches);
$h = floor($matches[1] / 3600);
$m = floor(($matches[1] - $h*3600) / 60);
$config['status1']['serverStatus1_uptime'] = $h.'h '.$m.'m';
preg_match('/monsters total="(\d+)"/', $data, $matches);
$config['status1']['serverStatus1_monsters'] = $matches[1];
}
else
{
$config['status1']['serverStatus1_online'] = 0;
$config['status1']['serverStatus1_players'] = 0;
$config['status1']['serverStatus1_playersMax'] = 0;
}
$file1 = fopen("config/serverstatus1", "w");
foreach($config['status1'] as $param => $data)
{
$file1_data .= $param.' = "'.str_replace('"', '', $data).'"
';
}
rewind($file1);
fwrite($file1, $file1_data);
fclose($file1);
}
4. End last modification in www/layouts/tibiacom/layout.php find and replace:
PHP:
<div id="ThemeboxesColumn">
<div id="RightArtwork">
<img id="Monster" src="monsters/<?PHP echo logo_monster() ?>.gif" onClick="window.location = '?subtopic=creatures&creature=<?PHP echo logo_monster() ?>';" alt="Monster of the Week" />
<img id="PedestalAndOnline" src="<?PHP echo $layout_name; ?>/images/header/pedestal-and-online.gif" alt="Monster Pedestal and Players Online Box"/>
<div id="PlayersOnline" onClick="window.location = '?subtopic=whoisonline'">
<?PHP
$config['status1'] = parse_ini_file('config/serverstatus1');
if($config['status']['serverStatus_online'] == 1)
echo $config['status']['serverStatus_players']+$config['status1']['serverStatus1_players'].'/'.$config['status']['serverStatus_playersMax'].'<br />Uptime:'.$config['status']['serverStatus_uptime'].'';
else
echo '<font color="red"><b>Server<br />OFFLINE</b></font>';
?></div>
</div>
And DONE...
If have you another idea only post here, this modifications work for me. :thumbup: