Skocz do zawartości

imagettftext


fir3xpl

Recommended Posts

<?
header("Content-type: image/png");
putenv('GDFONTPATH=' . realpath('.')); 
if(isset($_GET['k'])) $kolor = $_GET['k'];
	else $kolor = "255.255.255";
if(isset($_GET['t'])) $tlo = $_GET['t'];
	else $tlo = "1";

$image = imagecreatefrompng("tla/".$tlo.".png");
$colorobr =ImageColorAllocate($image, "0", "0", "0");
$c = explode('.', $kolor);
$color =ImageColorAllocate($image, $c[0], $c[1], $c[2]);
$ip = $_GET['i'];
$port = $_GET['p'];
$fp = fsockopen('udp://' . $ip, $port, $errno, $errstr);
if (!$fp)
{
	imagettftext($image, 14, 0, 49, 18, $colorobr, "arial.ttf", "Blad");
	imagettftext($image, 14, 0, 51, 18, $colorobr, "arial.ttf", "Blad");
	imagettftext($image, 14, 0, 50, 17, $colorobr, "arial.ttf", "Blad");
	imagettftext($image, 14, 0, 50, 19, $colorobr, "arial.ttf", "Blad");
	imagettftext($image, 14, 0, 51, 17, $colorobr, "arial.ttf", "Blad");
	imagettftext($image, 14, 0, 51, 19, $colorobr, "arial.ttf", "Blad");
	imagettftext($image, 14, 0, 49, 17, $colorobr, "arial.ttf", "Blad");
	imagettftext($image, 14, 0, 49, 19, $colorobr, "arial.ttf", "Blad");
	imagettftext($image, 14, 0, 50, 18, $color, "arial.ttf", "Blad");
}
else
{
	$packet = 'SAMP';
	$packet .= chr(strtok($ip, '.'));
	$packet .= chr(strtok('.'));
	$packet .= chr(strtok('.'));
	$packet .= chr(strtok('.'));
	$packet .= chr($port & 0xFF);
	$packet .= chr($port >> 8 & 0xFF);
	fwrite($fp, $packet.'i');
	fread($fp, 11);
	#pakiety
	$is_passworded = ord(fread($fp, 1));
	$plr_count   = ord(fread($fp, 2));
	$max_plrs   = ord(fread($fp, 2));
	$strlen    = ord(fread($fp, 4));
	$hostname   = fread($fp, $strlen);
	$strlen    = ord(fread($fp, 4));
	$gamemode   = fread($fp, $strlen);
	$strlen    = ord(fread($fp, 4));
	$mapname    = fread($fp, $strlen);
	$colorobr = ImageColorAllocate($image, 0, 0, 0);
	#hostname
	imagettftext($image, 14, 0, 49, 18, $colorobr, "arial.ttf", $hostname);
	imagettftext($image, 14, 0, 51, 18, $colorobr, "arial.ttf", $hostname);
	imagettftext($image, 14, 0, 50, 17, $colorobr, "arial.ttf", $hostname);
	imagettftext($image, 14, 0, 50, 19, $colorobr, "arial.ttf", $hostname);
	imagettftext($image, 14, 0, 51, 17, $colorobr, "arial.ttf", $hostname);
	imagettftext($image, 14, 0, 51, 19, $colorobr, "arial.ttf", $hostname);
	imagettftext($image, 14, 0, 49, 17, $colorobr, "arial.ttf", $hostname);
	imagettftext($image, 14, 0, 49, 19, $colorobr, "arial.ttf", $hostname);
	imagettftext($image, 14, 0, 50, 18, $color, "arial.ttf", $hostname);
	#ip
	imagettftext($image, 10, 0, 5, 31, $colorobr, "visitor.ttf", "IP: ".$ip.":".$port);
	imagettftext($image, 10, 0, 7, 31, $colorobr, "visitor.ttf", "IP: ".$ip.":".$port);
	imagettftext($image, 10, 0, 6, 29, $colorobr, "visitor.ttf", "IP: ".$ip.":".$port);
	imagettftext($image, 10, 0, 6, 31, $colorobr, "visitor.ttf", "IP: ".$ip.":".$port);
	imagettftext($image, 10, 0, 7, 29, $colorobr, "visitor.ttf", "IP: ".$ip.":".$port);
	imagettftext($image, 10, 0, 7, 31, $colorobr, "visitor.ttf", "IP: ".$ip.":".$port);
	imagettftext($image, 10, 0, 5, 29, $colorobr, "visitor.ttf", "IP: ".$ip.":".$port);
	imagettftext($image, 10, 0, 5, 31, $colorobr, "visitor.ttf", "IP: ".$ip.":".$port);
	imagettftext($image, 10, 0, 6, 30, $color, "visitor.ttf", "IP: ".$ip.":".$port);
	#gra
	imagettftext($image, 10, 0, 239, 30, $colorobr, "visitor.ttf", "Gra: ".$mapname." (Sa-MP)");
	imagettftext($image, 10, 0, 241, 30, $colorobr, "visitor.ttf", "Gra: ".$mapname." (Sa-MP)");
	imagettftext($image, 10, 0, 240, 29, $colorobr, "visitor.ttf", "Gra: ".$mapname." (Sa-MP)");
	imagettftext($image, 10, 0, 240, 31, $colorobr, "visitor.ttf", "Gra: ".$mapname." (Sa-MP)");
	imagettftext($image, 10, 0, 241, 29, $colorobr, "visitor.ttf", "Gra: ".$mapname." (Sa-MP)");
	imagettftext($image, 10, 0, 241, 31, $colorobr, "visitor.ttf", "Gra: ".$mapname." (Sa-MP)");
	imagettftext($image, 10, 0, 239, 29, $colorobr, "visitor.ttf", "Gra: ".$mapname." (Sa-MP)");
	imagettftext($image, 10, 0, 239, 31, $colorobr, "visitor.ttf", "Gra: ".$mapname." (Sa-MP)");
	imagettftext($image, 10, 0, 240, 30, $color, "visitor.ttf", "Gra: ".$mapname." (Sa-MP)");
	#haslo
	if ($is_passworded)
	{
		imagettftext($image, 10, 0, 239, 40, $colorobr, "visitor.ttf", "Haslo: Tak");
		imagettftext($image, 10, 0, 241, 40, $colorobr, "visitor.ttf", "Haslo: Tak");
		imagettftext($image, 10, 0, 240, 39, $colorobr, "visitor.ttf", "Haslo: Tak");
		imagettftext($image, 10, 0, 240, 41, $colorobr, "visitor.ttf", "Haslo: Tak");
		imagettftext($image, 10, 0, 241, 39, $colorobr, "visitor.ttf", "Haslo: Tak");
		imagettftext($image, 10, 0, 241, 41, $colorobr, "visitor.ttf", "Haslo: Tak");
		imagettftext($image, 10, 0, 239, 39, $colorobr, "visitor.ttf", "Haslo: Tak");
		imagettftext($image, 10, 0, 239, 41, $colorobr, "visitor.ttf", "Haslo: Tak");
		imagettftext($image, 10, 0, 240, 40, $color, "visitor.ttf", "Haslo: Tak");
	} 
	else
	{
		imagettftext($image, 10, 0, 239, 40, $colorobr, "visitor.ttf", "Haslo: Nie");
		imagettftext($image, 10, 0, 241, 40, $colorobr, "visitor.ttf", "Haslo: Nie");
		imagettftext($image, 10, 0, 240, 39, $colorobr, "visitor.ttf", "Haslo: Nie");
		imagettftext($image, 10, 0, 240, 41, $colorobr, "visitor.ttf", "Haslo: Nie");
		imagettftext($image, 10, 0, 241, 39, $colorobr, "visitor.ttf", "Haslo: Nie");
		imagettftext($image, 10, 0, 241, 41, $colorobr, "visitor.ttf", "Haslo: Nie");
		imagettftext($image, 10, 0, 239, 39, $colorobr, "visitor.ttf", "Haslo: Nie");
		imagettftext($image, 10, 0, 239, 41, $colorobr, "visitor.ttf", "Haslo: Nie");
		imagettftext($image, 10, 0, 240, 40, $color, "visitor.ttf", "Haslo: Nie");
	}
	#gracze
	imagettftext($image, 10, 0, 5, 40, $colorobr, "visitor.ttf", "Graczy: ".$plr_count."/".$max_plrs);
	imagettftext($image, 10, 0, 7, 40, $colorobr, "visitor.ttf", "Graczy: ".$plr_count."/".$max_plrs);
	imagettftext($image, 10, 0, 6, 39, $colorobr, "visitor.ttf", "Graczy: ".$plr_count."/".$max_plrs);
	imagettftext($image, 10, 0, 6, 41, $colorobr, "visitor.ttf", "Graczy: ".$plr_count."/".$max_plrs);
	imagettftext($image, 10, 0, 7, 39, $colorobr, "visitor.ttf", "Graczy: ".$plr_count."/".$max_plrs);
	imagettftext($image, 10, 0, 7, 41, $colorobr, "visitor.ttf", "Graczy: ".$plr_count."/".$max_plrs);
	imagettftext($image, 10, 0, 5, 39, $colorobr, "visitor.ttf", "Graczy: ".$plr_count."/".$max_plrs);
	imagettftext($image, 10, 0, 5, 41, $colorobr, "visitor.ttf", "Graczy: ".$plr_count."/".$max_plrs);
	imagettftext($image, 10, 0, 6, 40, $color, "visitor.ttf", "Graczy: ".$plr_count."/".$max_plrs);
	#mapa
	imagettftext($image, 10, 0, 5, 50, $colorobr, "visitor.ttf", "Mapa: ".$gamemode);
	imagettftext($image, 10, 0, 7, 50, $colorobr, "visitor.ttf", "Mapa: ".$gamemode);
	imagettftext($image, 10, 0, 6, 49, $colorobr, "visitor.ttf", "Mapa: ".$gamemode);
	imagettftext($image, 10, 0, 6, 51, $colorobr, "visitor.ttf", "Mapa: ".$gamemode);
	imagettftext($image, 10, 0, 7, 49, $colorobr, "visitor.ttf", "Mapa: ".$gamemode);
	imagettftext($image, 10, 0, 7, 51, $colorobr, "visitor.ttf", "Mapa: ".$gamemode);
	imagettftext($image, 10, 0, 5, 49, $colorobr, "visitor.ttf", "Mapa: ".$gamemode);
	imagettftext($image, 10, 0, 5, 51, $colorobr, "visitor.ttf", "Mapa: ".$gamemode);
	imagettftext($image, 10, 0, 6, 50, $color, "visitor.ttf", "Mapa: ".$gamemode);
	#strona
	###############################################################################
	$strona = "FullParty.xaa.pl";
	###############################################################################
	imagettftext($image, 10, 0, 344, 57, $colorobr, "visitor.ttf", $strona);
	imagettftext($image, 10, 0, 346, 57, $colorobr, "visitor.ttf", $strona);
	imagettftext($image, 10, 0, 345, 56, $colorobr, "visitor.ttf", $strona);
	imagettftext($image, 10, 0, 345, 58, $colorobr, "visitor.ttf", $strona);
	imagettftext($image, 10, 0, 346, 56, $colorobr, "visitor.ttf", $strona);
	imagettftext($image, 10, 0, 346, 58, $colorobr, "visitor.ttf", $strona);
	imagettftext($image, 10, 0, 344, 56, $colorobr, "visitor.ttf", $strona);
	imagettftext($image, 10, 0, 344, 58, $colorobr, "visitor.ttf", $strona);
	imagettftext($image, 10, 0, 345, 57, $color, "visitor.ttf", $strona);
	#end tekstów
	imagealphablending($image, false);
	imagesavealpha($image, true);
	imagepng($image);
	ImageDestroy($image);
	fclose($fp);
}
?> 

Chodzi o dodanie koloru do napisu : IP,GRACZE itp. Ale tylko do wybranych ten kolor , a nie całość. Nie umiem sobie z tym poradzić ;// Może ktoś pomoże..?

Link do komentarza
Udostępnij na innych stronach

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Gość
Odpowiedz...

×   Wkleiłeś treść z formatowaniem.   Usuń formatowanie

  Only 75 emoji are allowed.

×   Twój link będzie automatycznie osadzony.   Wyświetlać jako link

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Wczytywanie...
×
×
  • Utwórz nowe...