• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Status Server

Koci1994

Banned User
Joined
Dec 27, 2008
Messages
807
Reaction score
1
Siema.
Nie działa mi server status.
Nawet gdy Server jest online on ciągle wyświetla, że jest OFF.
Oto mój skrypt na status :
PHP:
<div class="content"> 
								<ul> 
<center><?PHP
						if($config['status']['serverStatus_online'] == 1)
				echo '<font color="green"><b>Server Online</b></font>';
			else
				echo '<font color="red"><b>Server Offline</b></font>';
			?></center>

								</ul>
							</div>
Proszę o pomoc.
 
Masz nadane chmody na serverstatus, zeby tego pliczka mogl config-and-functions.php updatowac?
 
Nie wiesz jak zrobić, żeby config-and-functions.php mógł aktualizować plik serverstatus ?
 
Gówno :)

Można przyjąć, że nasz zawodnik w config.lua postanowił ustawić:
Code:
bindOnlyConfiguredIpAddress = true
Przy tej opcji silnik nie slucha na loopbacku
A więc szukamy w config-and-functions.php :
Code:
$sock = @fsockopen("127.0.0.1", $config['server']['statusPort'], $errno, $errstr, 1);
i zmieniamy adres 127.0.0.1 na ip serwera albo
Code:
$sock = @fsockopen($config['server']['ip'], $config['server']['statusPort'], $errno, $errstr, 1);
Ps Widnet: masz tu fixa do nowej wersji aac.
 
Last edited:
w config.lua mam
bindOnlyConfiguredIpAddress = "no"
a w c-a-f.php mam
$sock = @fsockopen("127.0.0.1", $config['server']['port'], $errno, $errstr, 1);
I to :
PHP:
$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.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)
	{
$file_data .= $param.' = "'.str_replace('"', '', $data).'"
';
	}
	rewind($file);
	fwrite($file, $file_data);
	fclose($file);
}
 
Last edited:
To zmien:
Code:
$sock = @fsockopen("127.0.0.1", $config['server']['port'], $errno, $errstr, 1);
na:
Code:
$sock = @fsockopen($config['server']['ip'], $config['server']['statusPort'], $errno, $errstr, 1);
A nie czekasz na zbawienie stary aac albo pobierz od lolka nowego...
 
poczekaj to co jakis czas sprawdza... żeby przy dużym ruchu nie przydusić ots
w config/serverstatus
Code:
serverStatus_lastCheck = "1250343004"
zmien na:
Code:
serverStatus_lastCheck = ""
i od razu pokarze :)


@Edit
Za wolno odpisałem ale zostaw tamto ;) Bo nie próbowałem czy może za floodowac (to moje przypuszczenie) ale z jakiegoś powodu Gesior to zrobił.
 
Już wiem.
Jak zmienię tą wartość na większa to są częstsze aktualizacje:
PHP:
$statustimeout = $statustimeout / 1000;
 
Last edited:
Dzięki Specjalist. (You must spread some Reputation around before giving it to Specjalist again.)
statusTimeout = 5 * 60 * 1000
Ale nawet jak zmienie to w config.lua to będzie pisało co jakiś czas zamiast Online "1/50" samo "/"
Bo wpisałem
statusTimeout = 30 * 1000
Może to wina mojego kompa
Intel Core 2 Duo e8400 3.0Ghz
2 GB RAM (DDR2)
Internet ADSL 1,3Mb/s
A może to wina grafy :DDD
 
Last edited:
Back
Top