Skocz do zawartości
"Idzie nowe..." - o zmianach i nie tylko ×
Przeniesienie zakupów z IPS Marketplace / Moving bought items from IPS Marketplace ×

Gama

Użytkownik
  • Postów

    521
  • Dołączył

  • Ostatnia wizyta

  • Wygrane w rankingu

    1

Odpowiedzi opublikowane przez Gama

  1. Witajcie. Dzisiaj postanowiłem zacząć tworzyć swój pierwszy skin, pod wersję 3.2. Kolorystykę dobrałem, pozmieniałem parę rzeczy w kodzie, zmieniłem ikonki i wyszedł mi taki "header". i tu mam do Was prośbę - czy według Was zmierzam ku dobremu czy raczej powinienem zawrócić i pomyśleć jeszcze raz?

    Proszę Was o pomoc, bo wiem że się na tym znacie :)

    Oto ten header:

    pre_1311615855__header.png

    • Lubię to 1
  2. No cóż, skończyłem pracę to postanowiłem że się pochwalę :) Wiem, że ten temat ma niewiele wspólnego z ip.boardem, ale może DawPi i jego ekypa mi wybaczą :) ?

    A więc, skończyłem monitoring serwera dla serwerów sieci san andreas multiplayer. Jest on oznaczony wersją 2.0 i gromadzi najważniejsze informacje o serwerze w jednym miejscu. Stworzyłem plik config.php w którym można edytować najważniejsze wartości związane z działaniem "skryptu"

    configfile.png

    A teraz parę zrzutów ekranu:

    Strona główna

    serwers.png

    Komendy:

    commands.png

    I tu dodałem funkcjonalność, polegającą na tym że po najechaniu na komendę wyświetla się jej opis:

    commands_hover.png

    Strona z aktualnościami:

    news.png

    "Skrypt" tworzyłem około 3 dni. Wersji "live" nie mam - ale wkrótce będę miał. Oficjalna strona projektu: http://sourceforge.net/projects/sampmonitor

    Proszę o ocenę :) Z góry dzięki i pozdrawiam :)

    • Lubię to 2
  3. Ps: Nie rozumiem Was - syfiaste xaa? Dlaczego? Mnie jakoś ipb działa wszystko ładnie, kolega 3 lata ma już tam forum i jakoś nigdy nie miał problemów, ja również zawsze mam na xaa hosting i nic się nie dzieje, tylko Wy tak narzekacie

    Kamilz - nigdy nie miałeś żadnych problemów na tym hostingu? Spolszczenia nie da się wgrać inaczej niżeli modułami. Poza tym konwertery nie działają i połowa modułów jest wyłączona. No i te cron_job'y jako osobna (płatna) usługa. Ten hosting już dawno przestał być na top'ie (o ile w ogóle był). Zobacz także na datę ostatniego wpisu przez zespół proserwer.pl " [2010-08-01] Nowa oferta z gratisami w firmie ProSerwer " Już lepiej pofatygować się na pocztę i zrobić przekaz pocztowy w celu kupna hostingu z prawdziwego zdarzenia niż płacić (przepłacać) sms'em za jakieś dziadostwo.

  4. Witajcie. Dzisiaj stworzyłem monitoring mojego serwera. Na Windows wszystko działa, więc wgrywam pliki na serwer Linux i nagle wielkie zdziwienie, strona nie jest wyświetlana poprawnie.

    Strona na linux http://truck-drive.pl/monitoring/index.php

    Strona (ta poprawnie wyświetlana)

    pre_1310568896__dziala.png

    Kod PHP odpowiadający za monitoring

    <?php
    
    
    require "SampQueryAPI.php";
    $query = new SampQueryAPI('46.4.245.69', '7788');
    
    
    if($query->isOnline())
    {
    $aInformation = $query->getInfo();
    $aServerRules = $query->getRules();
    
    ?>
    <div class="general_box"><center><img src="_img/Server.png" align="absmiddle"/> Truck Drive Server SA:MP</center></div>
    <br />
    <div class="topic_buttons"><font color="white">Podstawowe informacje</font></div>
    <table width="400" class="fontfix">
    	<tr id="admin_bar" align="left">
    		<td><img src="_img/hostname.png" align="absmiddle"/> Nazwa</td>
    		<td><?= htmlentities($aInformation['hostname']) ?></td>
    	</tr>
    	<tr id="admin_bar" align="left">
    		<td><img src="_img/gamemode.png" align="absmiddle"/> Tryb Gry</td>
    		<td><?= htmlentities($aInformation['gamemode']) ?></td>
    	</tr>
    	<tr id="admin_bar" align="left">
    		<td><img src="_img/players.png" align="absmiddle"/> Gracze</td>
    		<td><?= $aInformation['players'] ?> / <?= $aInformation['maxplayers'] ?></td>
    	</tr>
    	<tr id="admin_bar" align="left">
    		<td><img src="_img/map.png" align="absmiddle"/> Mapa</td>
    		<td><?= htmlentities($aInformation['mapname']) ?></td>
    	</tr>
    	<tr id="admin_bar" align="left">
    		<td><img src="_img/weather.png" align="absmiddle"/> Pogoda</td>
    		<td><?= $aServerRules['weather'] ?></td>
    	</tr>
    	<tr id="admin_bar" align="left">
    		<td><img src="_img/time.png" align="absmiddle"/> Godzina</td>
    		<td><?= $aServerRules['worldtime'] ?></td>
    	</tr>
    	<tr id="admin_bar" align="left">
    		<td><img src="_img/version.png" align="absmiddle"/> Wersja</td>
    		<td><?= $aServerRules['version'] ?></td>
    	</tr>
    	<tr id="admin_bar" align="left">
    		<td><img src="_img/password.png" align="absmiddle"/> Hasło</td>
    		<td><?= $aInformation['password'] ? 'Yes' : '<img src="_img/no.png" />' ?></td>
    	</tr>
    </table>
    
    <br />
    <div class="topic_buttons"><font color="white">Gracze online</font></div>
    <?php
    
    $aPlayers = $query->getDetailedPlayers();
    
    if(!is_array($aPlayers) || count($aPlayers) == 0)
    {
    	echo '<br /><i>Brak graczy online</i>';
    }
    else
    {
    	?>
    	<table width="400" class="fontfix">
    		<tr>
    			<td id="admin_bar"><b>ID Gracza</b></td>
    			<td id="admin_bar"><b>Nick</b></td>
    			<td id="admin_bar"><b>Punkty</b></td>
    			<td id="admin_bar"><b>Ping</b></td>
    		</tr>
    	<?php
    	foreach($aPlayers as $sValue)
    	{
    		?>
    		<tr>
    			<td><?= $sValue['playerid'] ?></td>
    			<td><?= htmlentities($sValue['nickname']) ?></td>
    			<td><?= $sValue['score'] ?></td>
    			<td><?= $sValue['ping'] ?></td>
    		</tr>
    		<?php
    	}
    
    	echo '</table>';
    }
    }
    ?>

    I kod z SampQueryAPI.php http://files.typefish.co.uk/sa-mp/SampQueryAPI.php

  5. No no, świetny styl :) Twórz dalej skiny a może któregoś dnia będziesz na tym zarabiał :)

    Ponieważ widziałem na pewnym amerykańskim warezie taki sam innego autora, więc chce się upewnić.
    Warez jak to warez - tam to lubią się podszywać pod czyjeś prace :D
  6. A więc po dodaniu tego kodu:

    <php> 
    require('SampQueryAPI.php'); 
    </php>
    

    Forum działa normalnie, bez błędów

    A tu zawartość pliku SampQueryAPI.php

    <?php
    /**
    *	This API connects directly to the server, without any need for any
    *	middlemen connections.
    *	Your server must have fsockopen enabled in order to access the 
    *	functions that have been made available from this.
    *
    *	@package sampAPI
    *	@version 1.2
    *	@author David Weston <[email protected]>
    *	@copyright 2010; http://www.typefish.co.uk/licences/
    */
    
    
    class SampQueryAPI
    {
    /**
     *	@ignore
     */
    private $rSocket = false;
    
    
    /**
     *	@ignore
     */
    private $aServer = array();
    
    
    /**
     *	Creation of the server class.
     *
     *	@param string $sServer Server IP, or hostname.
     *	@param integer $iPort Server port
     */
    public function __construct($sServer, $iPort = 7777)
    {
    	/* Fill some arrays. */
    	$this->aServer[0] = $sServer;
    	$this->aServer[1] = $iPort;
    
    	/* Start the connection. */	
    	$this->rSocket = fsockopen('udp://'.$this->aServer[0], $this->aServer[1], $iError, $sError, 2);
    
    	if(!$this->rSocket)
    	{
    		$this->aServer[4] = false;
    		return;
    	}
    
    	socket_set_timeout($this->rSocket, 2);
    
    	$sPacket = 'SAMP';
    	$sPacket .= chr(strtok($this->aServer[0], '.'));
    	$sPacket .= chr(strtok('.'));
    	$sPacket .= chr(strtok('.'));
    	$sPacket .= chr(strtok('.'));
    	$sPacket .= chr($this->aServer[1] & 0xFF);
    	$sPacket .= chr($this->aServer[1] >> 8 & 0xFF);
    	$sPacket .= 'p4150';
    
    	fwrite($this->rSocket, $sPacket);
    
    	if(fread($this->rSocket, 10))
    	{
    		if(fread($this->rSocket, 5) == 'p4150')
    		{
    			$this->aServer[4] = true;
    			return;
    		}
    	}
    
    	$this->aServer[4] = false;
    }
    
    
    /**
     *	@ignore
     */
    public function __destruct()
    {
    	@fclose($this->rSocket);
    }
    
    
    /**
     *	Used to tell if the server is ready to accept queries.
     *
     *	If false is returned, then it is suggested that you remove the
     *	class from active use, so that you can reload the class if needs
     *	be.
     *
     *	@return bool true if success, false if failure.
     */
    public function isOnline()
    {
    	return isset($this->aServer[4]) ? $this->aServer[4] : false;
    }
    
    
    /**
     *	This function is used to get the server information.
     *
     *	<code>
     *	Array
     *	(
     *		[password] => 0
     *		[players] => 9
     *		[maxplayers] => 500
     *		[hostname] => Everystuff Tr3s [MAD]oshi (03a Final) [FIXED]
     *		[gamemode] => Stunt/Race/DM/FR Everystuff
     *		[mapname] => Everystuff
     *	)
     *	</code>
     *
     *	@return array Array of server information.
     */
    public function getInfo()
    {
    	@fwrite($this->rSocket, $this->createPacket('i'));
    
    	fread($this->rSocket, 11);
    
    	$aDetails['password'] = (integer) ord(fread($this->rSocket, 1));
    
    	$aDetails['players'] = (integer) $this->toInteger(fread($this->rSocket, 2));
    
    	$aDetails['maxplayers'] = (integer) $this->toInteger(fread($this->rSocket, 2));
    
    	$iStrlen = ord(fread($this->rSocket, 4));
    	if(!$iStrlen) return -1;
    
    	$aDetails['hostname'] = (string) fread($this->rSocket, $iStrlen);
    
    	$iStrlen = ord(fread($this->rSocket, 4));
    	$aDetails['gamemode'] = (string) fread($this->rSocket, $iStrlen);
    
    	$iStrlen = ord(fread($this->rSocket, 4));
    	$aDetails['mapname'] = (string) fread($this->rSocket, $iStrlen);
    
    	return $aDetails;
    }
    
    
    /**
     *	This function gets a basic list of all the players on the server.
     *
     *	Note as of 0.3.0, the amount of players that can be retrieved is
     *	limited to 100. This means if there are more players than 100,
     *	then no data will be returned, and it will be a blank array.
     *
     *	<code>
     *	Array
     *	(
     *		[0] => Array
    	 *			(
     *				[nickname] => K1nNngO
     *				[score] => 72
     *			)
     *		
     *		[1] => Array
     *			(
     *				[nickname] => [kikOo]
     *				[score] => 150
     *			)
     *
     *		[and so on...]
     *	)
     *	</code>
     *
     *	@return array Array of player information.
     */
    public function getBasicPlayers()
    {
    	@fwrite($this->rSocket, $this->createPacket('c'));
    	fread($this->rSocket, 11);
    
    	$iPlayerCount = ord(fread($this->rSocket, 2));
    	$aDetails = array();
    
    	if($iPlayerCount > 0)
    	{
    		for($iIndex = 0; $iIndex < $iPlayerCount; ++$iIndex)
    		{
    			$iStrlen = ord(fread($this->rSocket, 1));
    			$aDetails[] = array
    			(
    				"nickname" => (string) fread($this->rSocket, $iStrlen),
    				"score" => (integer) $this->toInteger(fread($this->rSocket, 4)),
    			);
    		}
    	}
    
    	return $aDetails;
    }
    
    
    /**
     *	This function gets a detailed list of all the players on the server.
     *
     *	Note as of 0.3.0, the amount of players that can be retrieved is
     *	limited to 100. This means if there are more players than 100,
     *	then no data will be returned, and it will be a blank array.
     *
     *	<code>
     *	Array
     *	(
     *		[0] => Array
     *			(
     *				[playerid] => 0
     *				[nickname] => K1nNngO
    	 *				[score] => 72
     *				[ping] => 195
     *			)
     *	
     *		[1] => Array
     *			(
     *				[playerid] => 1
     *				[nickname] => [kikOo]
     *				[score] => 150
     *				[ping] => 375
     *			)
     *
     *		[and so on...]
     *	)
     *	</code>
     *
     *	@return array Array of player information.
     */
    public function getDetailedPlayers()
    {
    	@fwrite($this->rSocket, $this->createPacket('d'));
    	fread($this->rSocket, 11);
    
    	$iPlayerCount = ord(fread($this->rSocket, 2));
    	$aDetails = array();
    
    	for($iIndex = 0; $iIndex < $iPlayerCount; ++$iIndex)
    	{
    		$aPlayer['playerid'] = (integer) ord(fread($this->rSocket, 1));
    
    		$iStrlen = ord(fread($this->rSocket, 1));
    		$aPlayer['nickname'] = (string) fread($this->rSocket, $iStrlen);
    
    		$aPlayer['score'] = (integer) $this->toInteger(fread($this->rSocket, 4));
    		$aPlayer['ping'] = (integer) $this->toInteger(fread($this->rSocket, 4));
    
    		$aDetails[] = $aPlayer;
    		unset($aPlayer);
    	}
    
    	return $aDetails;
    }
    
    
    /**
     *	This function gets all the server rules from the server.
     *
     *	Rules in this context are not player rules, they are client rules,
     *	like the weather of the server, time, and so on. (Custom rules,
     *	when supported by a SA-MP plugin, will be included here.) 
     *
     *	<code>
     *	Array
     *	(
     *		[gravity] => 0.007900
     *		[mapname] => Everystuff
     *		[version] => 0.3a
     *		[weather] => 0
     *		[weburl] => samp.madoshi.net
     *		[worldtime] => 12:00
     *	)
     *	</code>
     *
     *	@return array Array of server rules.
     */
    public function getRules()
    {
    	@fwrite($this->rSocket, $this->createPacket('r'));
    	fread($this->rSocket, 11);
    
    	$iRuleCount = ord(fread($this->rSocket, 2));
    		$aReturn = array();
    
    	for($iIndex = 0; $iIndex < $iRuleCount; ++$iIndex)
    	{
    		$iStrlen = ord(fread($this->rSocket, 1));
    		$sRulename = (string) fread($this->rSocket, $iStrlen);
    
    		$iStrlen = ord(fread($this->rSocket, 1));
    		$aDetails[$sRulename] = (string) fread($this->rSocket, $iStrlen);
    	}
    
    	return $aDetails;
    }
    
    
    /**
     *	@ignore
     */
    private function toInteger($sData)
    {
    	if($sData === "")
    	{
    		return null;
    	}
    
    		$iInteger = 0;
    		$iInteger += (ord($sData[0]));
    
    		if(isset($sData[1]))
    		{
    			$iInteger += (ord($sData[1]) << 8);
    		}
    
    		if(isset($sData[2]))
    		{
    			$iInteger += (ord($sData[2]) << 16);
    		}
    
    		if(isset($sData[3]))
    		{
    			$iInteger += (ord($sData[3]) << 24);
    		}
    
    		if($iInteger >= 4294967294)
    	{
    			$iInteger -= 4294967296;
    	}
    
    		return $iInteger;
    }
    
    
    /**
     *	@ignore
     */
    private function createPacket($sPayload)
    {
    	$sPacket = 'SAMP';
    	$sPacket .= chr(strtok($this->aServer[0], '.'));
    	$sPacket .= chr(strtok('.'));
    	$sPacket .= chr(strtok('.'));
    	$sPacket .= chr(strtok('.'));
    	$sPacket .= chr($this->aServer[1] & 0xFF);
    	$sPacket .= chr($this->aServer[1] >> 8 & 0xFF);
    	$sPacket .= $sPayload;
    
    	return $sPacket;
    }
    }
    

×
×
  • Dodaj nową pozycję...

Powiadomienie o plikach cookie

Umieściliśmy na Twoim urządzeniu pliki cookie, aby pomóc Ci usprawnić przeglądanie strony. Możesz dostosować ustawienia plików cookie, w przeciwnym wypadku zakładamy, że wyrażasz na to zgodę.