ImperatorYT 0 Opublikowano 1 grudnia 2018 Udostępnij Opublikowano 1 grudnia 2018 Mógłby ktoś napisać lub podlinkować darmowy (działający) rcon na 1.13? Wszystkie, które testowałem są z 2015 > i nie działają. Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
0 AidisProPlayer 10 Opublikowano 1 grudnia 2018 Udostępnij Opublikowano 1 grudnia 2018 (edytowane) Nie wiem co ci może nie działać, tworzyłem ostatnio itemshop oparty o funkcje RCON i wszystko działa prawidłowo serwer 1.8-1.13.3 na spigocie. Tutaj masz przykłady połączenia: Zarejestruj się lub zaloguj, aby zobaczyć ukrytą treść! Zarejestruj się lub zaloguj, aby zobaczyć ukrytą treść! Pomogłem daj "Lubię To" Edytowane 1 grudnia 2018 przez AidisProPlayer Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
0 kamizz 0 Opublikowano 1 grudnia 2018 Udostępnij Opublikowano 1 grudnia 2018 Wykonałem kod wgl podanego wyżej linku i nie chce zadziałać index.html <!DOCTYPE html> <html lang="pl" > <head> <meta charset="UTF-8"> <title>test</title> <link rel="Shortcut icon" href="logo.jpg" /> <link rel="stylesheet" href="css/style.css"> </head> <body> <div class="login-page"> <br><h3>Powiedz Hello Word!</h3> <div class="form"> <form action="wykonaj.php" method="post" class="login-form"> <input type="text" name="nick" placeholder="Nick" /> <input type="submit" value="Zaloguj się" class="primary" /> <p class="message">Dziękujemy za skorzystanie z <a href="#" target="_blank">Rcon</a>.</p> </form> </div> </div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script> </body> </html> wykonaj.php <?php require_once('Rcon.php'); $host = 'ip'; // Server host name or IP $port = 37786; // Port rcon is listening on $password = 'haslo'; // rcon.password setting set in server.properties $timeout = 3; // How long to timeout. use Thedudeguy\Rcon; $rcon = new Rcon($host, $port, $password, $timeout); if ($rcon->connect()) { $rcon->sendCommand("say Hello World!"); } header('Location: https://xx/testrcon/'); exit; ?> Rcon.php <?php /** * See https://developer.valvesoftware.com/wiki/Source_RCON_Protocol for * more information about Source RCON Packets * * PHP Version 7 * * @copyright 2013-2017 Chris Churchwell * @author thedudeguy * @link https://github.com/thedudeguy/PHP-Minecraft-Rcon */ namespace Thedudeguy; class Rcon { private $host; private $port; private $password; private $timeout; private $socket; private $authorized = false; private $lastResponse = ''; const PACKET_AUTHORIZE = 5; const PACKET_COMMAND = 6; const SERVERDATA_AUTH = 3; const SERVERDATA_AUTH_RESPONSE = 2; const SERVERDATA_EXECCOMMAND = 2; const SERVERDATA_RESPONSE_VALUE = 0; /** * Create a new instance of the Rcon class. * * @param string $host * @param integer $port * @param string $password * @param integer $timeout */ public function __construct($host, $port, $password, $timeout) { $this->host = $host; $this->port = $port; $this->password = $password; $this->timeout = $timeout; } /** * Get the latest response from the server. * * @return string */ public function getResponse() { return $this->lastResponse; } /** * Connect to a server. * * @return boolean */ public function connect() { $this->socket = fsockopen($this->host, $this->port, $errno, $errstr, $this->timeout); if (!$this->socket) { $this->lastResponse = $errstr; return false; } //set timeout stream_set_timeout($this->socket, 3, 0); // check authorization return $this->authorize(); } /** * Disconnect from server. * * @return void */ public function disconnect() { if ($this->socket) { fclose($this->socket); } } /** * True if socket is connected and authorized. * * @return boolean */ public function isConnected() { return $this->authorized; } /** * Send a command to the connected server. * * @param string $command * * @return boolean|mixed */ public function sendCommand($command) { if (!$this->isConnected()) { return false; } // send command packet $this->writePacket(self::PACKET_COMMAND, self::SERVERDATA_EXECCOMMAND, $command); // get response $response_packet = $this->readPacket(); if ($response_packet['id'] == self::PACKET_COMMAND) { if ($response_packet['type'] == self::SERVERDATA_RESPONSE_VALUE) { $this->lastResponse = $response_packet['body']; return $response_packet['body']; } } return false; } /** * Log into the server with the given credentials. * * @return boolean */ private function authorize() { $this->writePacket(self::PACKET_AUTHORIZE, self::SERVERDATA_AUTH, $this->password); $response_packet = $this->readPacket(); if ($response_packet['type'] == self::SERVERDATA_AUTH_RESPONSE) { if ($response_packet['id'] == self::PACKET_AUTHORIZE) { $this->authorized = true; return true; } } $this->disconnect(); return false; } /** * Writes a packet to the socket stream. * * @param $packetId * @param $packetType * @param string $packetBody * * @return void */ private function writePacket($packetId, $packetType, $packetBody) { /* Size 32-bit little-endian Signed Integer Varies, see below. ID 32-bit little-endian Signed Integer Varies, see below. Type 32-bit little-endian Signed Integer Varies, see below. Body Null-terminated ASCII String Varies, see below. Empty String Null-terminated ASCII String 0x00 */ //create packet $packet = pack('VV', $packetId, $packetType); $packet = $packet.$packetBody."\x00"; $packet = $packet."\x00"; // get packet size. $packet_size = strlen($packet); // attach size to packet. $packet = pack('V', $packet_size).$packet; // write packet. fwrite($this->socket, $packet, strlen($packet)); } /** * Read a packet from the socket stream. * * @return array */ private function readPacket() { //get packet size. $size_data = fread($this->socket, 4); $size_pack = unpack('V1size', $size_data); $size = $size_pack['size']; // if size is > 4096, the response will be in multiple packets. // this needs to be address. get more info about multi-packet responses // from the RCON protocol specification at // https://developer.valvesoftware.com/wiki/Source_RCON_Protocol // currently, this script does not support multi-packet responses. $packet_data = fread($this->socket, $size); $packet_pack = unpack('V1id/V1type/a*body', $packet_data); return $packet_pack; } } Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
0 ImperatorYT 0 Opublikowano 1 grudnia 2018 Autor Udostępnij Opublikowano 1 grudnia 2018 @AidisProPlayer jak coś kamizz jest moim technikiem. Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
0 AidisProPlayer 10 Opublikowano 1 grudnia 2018 Udostępnij Opublikowano 1 grudnia 2018 index.html i wykonaj.php do poważnej poprawy to nie ma prawa działać. Brak połączenia miedzy for a skryptem Brak przekazu funkcji require_once('Rcon.php'); na końcu skryptu Jeżeli chcecie pomocy piszcie tutaj na discordzie: AidisProPlayer#4324 Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
0 kamizz 0 Opublikowano 1 grudnia 2018 Udostępnij Opublikowano 1 grudnia 2018 wysłałem zaproszenie na discord Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
Pytanie
ImperatorYT 0
Mógłby ktoś napisać lub podlinkować darmowy (działający) rcon na 1.13? Wszystkie, które testowałem są z 2015 > i nie działają.
Odnośnik do komentarza
Udostępnij na innych stronach
5 odpowiedzi na to pytanie
Rekomendowane odpowiedzi