Ayyıldız2 | 2008 TR Yapısı • 1-99 Orta Emek Destan • 10 Temmuz 21:00 HEMEN TIKLA!
php ile p2p bağlantısı yapıp anlık online sayısını almak istiyorum fakat başaramadım.
Alt yapı olarak martysama v4 kurulu.
corelerdeki config
adminpage_ip: 192.168.1.106
adminpage_ip0: 192.168.1.106
adminpage_ip1: 192.168.1.106
adminpage_ip2: 192.168.1.106
adminpage_ip3: 192.168.1.106
adminpage_password: 1rr12r3rfv-233232324*223320123*2-_'2!!1$$$###
eklemeleri yaptım.
adminpage_ip server ip adresi mi olacak yoksa site api adresi mi olacak orada takıldım yardımcı olursanız sevinirim .. Teşekkürler..
Alt yapı olarak martysama v4 kurulu.
Kod:
function SendServer($text, $type = "NOTICE", $port = 13000)
{
// IP and ADMINPAGE_PASSWORD of your Metin2 server
$addr = ""; $pass = "";
// CREATE
$socket = socket_create (AF_INET, SOCK_STREAM, SOL_TCP);
if ($socket < 0)
{
echo "\n Invalid socket definition...\n";
exit;
}
$result = socket_connect ($socket, $addr, $port);
if ($result < 0)
{
echo "\n Connection Error. Error : ".socket_strerror($result)."\n";
}
if($type == "USER_COUNT") {
$query = "\x40".$type."\x0A";
} else {
$query2 = "\x40".$pass."\x0A";
$query_size2 = strlen($query2);
$query_result2 = socket_write($socket, $query2, $query_size2);
socket_recv($socket, $result2, 256, 0);
$query = "\x40".$type." ".$text."\x0A";
}
$query_size = strlen($query);
$query_result = socket_write($socket, $query, $query_size);
if ($query_result < 0)
{
echo "ERROR: ".socket_strerror($query_result)."\n";
}
else
{
$result1 = socket_recv($socket, $result2, 256, 0);
if ($type == "USER_COUNT")
{
$count = trim($result2);
$count = explode(' ', $count);
//$count[0] = users on channel online
//$count[1] = users in red kingdom online
//$count[2] = users in yellow kingdom online
//$count[3] = users in blue kingdom online
//$count[4] = users on core online
return $count;
}
else
{
return "$result2\n";
}
}
// CLOSE
socket_close($socket);
}
corelerdeki config
adminpage_ip: 192.168.1.106
adminpage_ip0: 192.168.1.106
adminpage_ip1: 192.168.1.106
adminpage_ip2: 192.168.1.106
adminpage_ip3: 192.168.1.106
adminpage_password: 1rr12r3rfv-233232324*223320123*2-_'2!!1$$$###
eklemeleri yaptım.
adminpage_ip server ip adresi mi olacak yoksa site api adresi mi olacak orada takıldım yardımcı olursanız sevinirim .. Teşekkürler..
