FOnline Development > Questions and Answers

FOnline SDK - Question

<< < (16/93) > >>

raynor009:
Ok smart guy.So got any idea how to do it?

jan0s1k:

--- Quote from: raynor009 on January 04, 2011, 08:21:46 pm ---Ok smart guy.So got any idea how to do it?

--- End quote ---
Sure, first step is learn any language :) Then create socket in app, put results to text file (or make, that app will generate picture) and let some other tools to make it image and copy in your www server :)
Or just do it by PHP, but there is a lot of work ;p
Or use my server status (which can be deleted in any time, etc, but I think, that for now it will stay):
status.chosensoldiers.tk - for this, how to use it, go on fonline.ru (my post before is link)

Wipe:

--- Quote ---<?php
$host = "94.23.237.127";
$port = "2238";

$socket = socket_create(AF_INET, SOCK_STREAM, 0) or die( "create\n" );
if( socket_connect( $socket, $host, $port ))
{
   $magic = pack( 'L', 0xFFFFFFFF );
   socket_write( $socket, $magic, strlen($magic) ) || die( "write\n" );
   $buf = '';
   socket_recv($socket, $buf, 16, MSG_PEEK );
   socket_close( $socket );
   if( strlen( $buf ) < 16 )
      die( "recv\n" );
   $data = unpack( 'L*', $buf );
   $online = $data[1];
   $uptime = $data[2];
   //print( "online: $online, uptime: $uptime seconds" );
   $img = imagecreate( 200, 50 );
   $bg = imagecolorallocate($img, 255, 255, 255);
   $black = imagecolorallocate($img, 0, 0, 0 );
   imagestring($img, 5, 0, 0, "Online: $online", $black );
   imagestring($img, 5, 0, 20, "Uptime: $uptime", $black );
   header('Content-type: image/png');
   imagepng( $img );
   imagedestroy( $img );
}
else
   die( "connect\n" );
?>
--- End quote ---

Seriously, it was 10m of work (including googling php socket function) - first (and probably last) time i used sockets in php... Yea, i know it's uberugly - CptRookie, don't say anything :>

raynor009:
wtf is that?!? it look more complicated than c++.anyway thanks both of you for fast reply.

Wipe:

--- Quote from: raynor009 on January 04, 2011, 10:02:41 pm ---wtf is that?!? it look more complicated than c++.anyway thanks both of you for fast reply.

--- End quote ---

Complicated? You gotta be kidding me...

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version