dansmirnov
5.06.2015 - 14:50
Открываю раздел на сайте и пишет такое
Parse error: syntax error, unexpected '}' in /var/www/u54503/data/www/exrp.gtahost.ru/SampQueryAPI.php on line 83
TranceIT
5.06.2015 - 14:57
Гугл переводчик в помощь
_____________
Безвозмездно помогаю только тем, кто сам пытается что-то сделать. Остальным за WMR
Даже если там 10 строк кода!
Даже если мне это ничего не стоит!
Даже если вы нуб!
JohnBraxton
5.06.2015 - 15:04
Ошибка в работе скрипта. покажи код (участок кода) файла SampQueryAPI.php
dansmirnov
5.06.2015 - 15:39
Цитата (JohnBraxton @ 5.06.2015 - 15:04) |
Ошибка в работе скрипта. покажи код (участок кода) файла SampQueryAPI.php |
<?php
class SampQueryAPI
{
private $rSocket = false;
private $aServer = array();
public function __construct($sServer, $iPort = 7777)
{
$this->aServer[0] = $sServer;
$this->aServer[1] = $iPort;
$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;
}
public function __destruct()
{
@fclose($this->rSocket);
}
public function isOnline()
{
return isset($this->aServer[4]) ? $this->aServer[4] : false;
}
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;
}
public function getBasicPlayers()
{
@fwrite($this->rSocket, $this->createPacket('c'));
fread($this->rSocket, 11);
$iPlayerCo
JohnBraxton
5.06.2015 - 15:44
Ужас конечно.........
Так попробуй...
<?php
class SampQueryAPI
{
private $rSocket = false;
private $aServer = array();
public function __construct($sServer, $iPort = 7777)
{
$this->aServer[0] = $sServer;
$this->aServer[1] = $iPort;
$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;
}
public function __destruct()
{
@fclose($this->rSocket);
}
public function isOnline()
{
return isset($this->aServer[4]) ? $this->aServer[4] : false;
}
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;
}
public function getBasicPlayers()
{
@fwrite($this->rSocket, $this->createPacket('c'));
fread($this->rSocket, 11);
$iPlayerCo;
}
}