Peršokti į turinį
  • ŽAIDIMAI
  • , ŽAIDIMAI
  • ŽAIDIMAI

Ši tema yra neaktyvi. Paskutinis pranešimas šioje temoje buvo prieš 4053 dienas (-ų). Patariame sukurti naują temą, o ne rašyti naują pranešimą.

Už neaktyvių temų prikėlimą galite sulaukti įspėjimo ir pranešimo pašalinimo!

Recommended Posts

Kazkoki turiu, nezinau ar tiks:

<?php

class MCServerStatus {

public $server; public $online, $motd, $online_players, $max_players; public $error = "OK";

function __construct($url, $port = '25565') {

$this->server = array( "url" => $url, "port" => $port );

if ( $sock = @stream_socket_client('tcp://'.$url.':'.$port, $errno, $errstr, 1) ) {

$this->online = true;

fwrite($sock, "\xfe"); $h = fread($sock, 2048); $h = str_replace("\x00", '', $h); $h = substr($h, 2); $data = explode("\xa7", $h); unset($h); fclose($sock);

if (sizeof($data) == 3) { $this->motd = $data[0]; $this->online_players = (int) $data[1]; $this->max_players = (int) $data[2]; } else { $this->error = "Cannot retrieve server info."; }

} else { $this->online = false; $this->error = "Cannot connect to server."; }

}

}

include "MCServerStatus.php"; $server = new MCServerStatus("s.nerd.nu", 25565); //The second argument is optional in this case

$var = $server->online; //$server->online returns true if the server is online, and false otherwise echo $server->motd; //Outputs the Message of the Day echo $server->online_players; //Outputs the number of players online echo $server->max_players; //Outputs the maximum number of players the server allows print_r($server); //Shows an overview of the object and its contents. (For debugging.)

  • Teigiamai 2

Ši tema yra neaktyvi. Paskutinis pranešimas šioje temoje buvo prieš 4053 dienas (-ų). Patariame sukurti naują temą, o ne rašyti naują pranešimą.

Už neaktyvių temų prikėlimą galite sulaukti įspėjimo ir pranešimo pašalinimo!

Svečias
Ši tema yra užrakinta.
  • Šiame puslapyje naršo:   0 nariai

    • Nėra registruotų narių peržiūrinčių šį forumą.

Skelbimai



×
×
  • Sukurti naują...