Znalazłem na tym forum temat w którym był status servera na banerze w tym momęcie przerobiłem skrypt na taki
<?php
$ext = '.png'; //rozszerzenie
$base = 'baner'; //tlo podstawowe
$fonts = array('./lucon.ttf', './ocr.ttf', './impact.ttf', './cs.ttf', './digit.ttf', './bitsumis.ttf', './xirod.ttf');
$quality = '100'; //jakosc
$cachefile = "./cache/server_".$_SERVER['QUERY_STRING'].$ext;
$cachefile = str_replace(':', '-', $cachefile);
$cachetime = 30; //czas cache'owania
if (file_exists($cachefile) && (time() - $cachetime < filemtime($cachefile)))
{
send_headers();
echo file_get_contents($cachefile);
exit;
}
ob_start();
define("CLASS_PQ_PHP", 1);
include_once("./SNS/class_PQ.php");
include_once("./SNS/PQ/PQ_PARENT.php");
include_once("./SNS/PQ/halflife.php");
if (strpos($_GET['ip'], ':'))
{
$ipp = explode(":", $_GET['ip']);
if (count($ipp)==2)
{
$conf_ip = $ipp[0];
$conf_port = $ipp[1];
}
} else {
$conf_ip = ($_GET['ip'])?$_GET['ip']:'localhost';
$conf_port = ($_GET['port'])?$_GET['port']:'27015';
$nazwa = ($_GET['nazwa'])?$_GET['nazwa']:'Strzelnica-Wolomin.pl';
}
if (strlen($conf_port)>5)
$conf_port = substr($conf_port, 0, 5);
$conf = array(
'ip' => $conf_ip,
'port' => $conf_port,
'querytype' => 'halflife',
'master' => 0,
'timeout' => 3,
'retries' => 1,
);
$pq = PQ::create($conf);
$info = $pq->query_info($conf['ip'].':'.$conf['port']);
$w = 350; //szerokosc
$h = 20; //wysokosc
if (true)
{
if($ext == '.jpg') {
$input = imagecreatefromjpeg($base . $ext);
} else if($ext == '.png') {
$input = imagecreatefrompng($base . $ext);
imageAlphaBlending($input, true);
imageSaveAlpha($input, true);
}
} else {
$input = imagecreatetruecolor($w, $h);
imagefilledrectangle($input, 1, 1, $w-2, $h-2, imagecolorallocate($input, 128, 128, 128));
}
//rozne kolory
$white = imagecolorallocate($input, 255, 255, 255);
$grey = imagecolorallocate($input, 128, 128, 128);
$black = imagecolorallocate($input, 0, 0, 0);
$blue = imagecolorallocate($input, 0, 0, 255);
$green = imagecolorallocate($input, 0, 255, 0);
$red = imagecolorallocate($input, 255, 0, 0);
$pink = imagecolorallocate($input, 255, 105, 180);
$yellow = imagecolorallocate($input, 255, 255, 0);
$niebieski = imagecolorallocate($input, 59, 57, 58);
if ($info==NULL)
{
imagettftext($input,
9, //size
0, //angle
35, //x
14, //y
$niebieski,
$fonts[4],
$nazwa);
imagettftext($input,
10, //size
0, //angle
310, //x
15, //y
$white,
$fonts[2],
'OFF');
}
else
{
imagettftext($input,
9, //size
0, //angle
35, //x
8, //y
$niebieski,
$fonts[5],
$nazwa); //nazwa serwera
$ipport = htmlspecialchars(strtoupper($info['ip'].':'.$info['port']));
imagettftext($input,
8, //size
0, //angle
35, //x
18, //y
$white,
$fonts[2],
$ipport); //IP:PORT
$size = imagettfbbox(9, 0, $fonts[0], $ipport);
$width = 45 + abs($size[2] - $size[0]);
$pltn = htmlspecialchars(strtoupper($info['totalplayers'].'/'.$info['maxplayers']));
imagettftext($input,
7, //size
0, //angle
301, //x
14, //y
$white,
$fonts[6],
$pltn); //ilosc graczy / max ilosc
$size2 = imagettfbbox(9, 0, $fonts[0], $pltn);
$width2 = $width + 10 + abs($size2[2] - $size2[0]);
imagettftext($input,
5, //size
0, //angle
165, //x
18, //y
$black,
$fonts[6],
htmlspecialchars($info['map'])); //mapka
}
if($ext == '.jpg') {
imagejpeg($input, NULL, $quality);
} else if($ext == '.png') {
imagepng($input, NULL, ($quality / 10) - 1);
}
function send_headers() {
global $config;
if($ext == '.png') {
header ('Content-type: image/png');
} else {
header ('Content-type: image/jpeg');
}
}
$fp = fopen($cachefile, 'wb');
fwrite($fp, ob_get_contents());
fclose($fp);
send_headers();
ob_end_flush();
?>Nie moge wstawić na to forum aktualnego banera bo blokuje ale jest na stronie głównej mojego forum strzelnica-wolomin.pli chciałbym zeby jak server jest ofline zmieniło się tło na inny plik bo mam takie dwa
i nie wiem jak to zrobić żeby się zmieniało i jeszcze drugie pytanie w jaki sposób można zrobić wykres na tym banerze z góry dzięki wielkie za pomoc oczywiscie poleci reputacja w załączniku reszta plików
abc.rar 245,99 KB 112 Ilość pobrań

Dodatki SourceMod



Temat jest zamknięty










