Author Topic: FOnline SDK - Question  (Read 147978 times)

Re: FOnline SDK - Question
« Reply #75 on: January 04, 2011, 08:21:46 pm »
Ok smart guy.So got any idea how to do it?

Offline jan0s1k

  • If it bleeds we can kill it...
    • Chosen Soldiers
Re: FOnline SDK - Question
« Reply #76 on: January 04, 2011, 09:26:39 pm »
Ok smart guy.So got any idea how to do it?
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)


Offline Wipe

  • Rotator
  • Random is god
Re: FOnline SDK - Question
« Reply #77 on: January 04, 2011, 09:45:44 pm »
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" );
?>

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 :>
Games are meant to be created, not played...

Re: FOnline SDK - Question
« Reply #78 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.

Offline Wipe

  • Rotator
  • Random is god
Re: FOnline SDK - Question
« Reply #79 on: January 04, 2011, 10:30:07 pm »
wtf is that?!? it look more complicated than c++.anyway thanks both of you for fast reply.

Complicated? You gotta be kidding me...
Games are meant to be created, not played...

Re: FOnline SDK - Question
« Reply #80 on: January 04, 2011, 10:43:12 pm »
Wut i newer had the patients to learn web programmin .All i learned was VB.net ,C# and now i try C++

Offline Surf

  • Moderator
  • это моё.
Re: FOnline SDK - Question
« Reply #81 on: January 04, 2011, 10:47:13 pm »
Next time you should be a bit more grateful when people are trying to help you instead of writing "wut" or "wtf".  ::)

Offline jan0s1k

  • If it bleeds we can kill it...
    • Chosen Soldiers
Re: FOnline SDK - Question
« Reply #82 on: January 04, 2011, 10:49:42 pm »
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 :>
I'm poor :( My work takes something around one week ;p and it isn't too much changes between my and yours script (in my I have some things to, if server is offline don't wait this 30 seconds, but it doesn't work -.-)


Re: FOnline SDK - Question
« Reply #83 on: January 04, 2011, 10:57:05 pm »
@raynor009: added some commentary for you.

Code: [Select]
<?php
$host 
"94.23.237.127"// Server IP address
$port "2238"// Server port

$socket socket_create(AF_INETSOCK_STREAM0) or die( "create\n" ); // create TCP Socket for server connection, abort on error
if( socket_connect$socket$host$port ) ) // connect to $host:$port
{
   
$magic pack'L'0xFFFFFFFF ); // create "magic query packet" (4 0xff bytes)
   
socket_write($socket$magic) || die( "write\n" ); // send "magic query packet" to server, abort on error
   
$buf '';
   
$recv socket_recv($socket$buf16MSG_PEEK ); // recieve server status (16 bytes)
   
socket_close($socket ); // disconnect
   
if( $recv 16 // abort on too short data recieved
      
die( "recv\n" );
   
$data unpack'V*'$buf ); // unpack recieved data - 4 Little Endian integers - 1st is current online, 2nd is uptime in seconds, others 2 are reserved
   
$online $data[1];  // see above
   
$uptime $data[2]; //see above
   //print( "online: $online, uptime: $uptime seconds" ); // debug ;)
   
$img imagecreate20050 ); // create 200x50px image
   
$bg imagecolorallocate($img255255255); // fill background with RGB(255,255,255) (white)
   
$black imagecolorallocate($img00); // allocate RGB(0,0,0) (black) for strings
   
imagestring($img500"Online: $online"$black ); // Write online count onto image
   
imagestring($img5020"Uptime: $uptime"$black ); // Write uptime onto image
   
header('Content-type: image/png'); // Set Content-type http headers, so browser knows it receives an image
   
imagepng$img ); // Output PNG image
   
imagedestroy$img ); // Deallocate image
}
else 
// Abort on failed connection
   
die( "connect\n" );
?>


Re: FOnline SDK - Question
« Reply #84 on: January 04, 2011, 11:14:51 pm »
This is great! Thank you all of you!  8) .I also made a quick aplication but it isnt very advanced.Only says if its on or not.You can try it out bellow is link ;)

DOWNLOAD ME


Offline jan0s1k

  • If it bleeds we can kill it...
    • Chosen Soldiers
Re: FOnline SDK - Question
« Reply #85 on: January 05, 2011, 02:37:55 pm »
This is great! Thank you all of you!  8) .I also made a quick aplication but it isnt very advanced.Only says if its on or not.You can try it out bellow is link ;)

DOWNLOAD ME


wow ;p I can do this with lower requirement (gui takes space too!):
Code: [Select]
cmd
ping fonline2238.net
echo Yea, I'm boss
save as status.bat and then run it ;p


Re: FOnline SDK - Question
« Reply #86 on: January 05, 2011, 05:46:54 pm »
Code: [Select]
[00:073] FOnline server, version 0396-A1.
[01:039] ***   Starting initialization   ****
[01:042] Script system initialization...
[01:055] Reload scripts...
[01:953] Reload scripts complete.
[01:953] Bind reserved functions...
[01:969] Bind reserved functions complete.
[01:969] Script system initialization complete.
[01:969] Loading language packs...
[02:032] Loading language packs complete, loaded<2> packs.
[02:032] Reload client scripts...
[02:156] Reload client scripts complete.
[02:156] Indexing client data.
[02:158] Indexing complete, clients found<15>.
[02:159] AI manager initialization...
[02:159] Find bags...
[02:185] Loaded<154> bags.
[02:185] AI manager initialization complete.
[02:185] Item manager initialization...
[02:186] Item manager initialization complete.
[02:186] Critter manager initialization...
[02:201] Critter manager initialization complete.
[02:201] Map manager initialization...
[02:203] Map manager initialization complete.
[02:203] Var Manager initialization.
[02:203] Update template vars...
[02:426] Update template vars complete.
[02:426] Var Manager initialization complete.
[02:426] Load Dialogs...[02:426] from list<dialogs.lst>.
[02:911] Loading dialogs finish, loaded<799/799>.
[02:992] FixBoy load crafts...
[02:992] FixBoy load crafts complete.
[02:997] Loaded<137> critter types.
[03:004] Refresh GM Mask<wm.msk>...[03:014] size<1400><1500>. complete.
[03:014] Loading items prototypes...
[03:154] Items prototypes successfully loaded, count<4608>.
[03:154] Loading critters prototypes...
[03:191] Loaded<515> critter protos, errors<0>.
[03:191] Load maps prototypes...
[03:484] Script::Bind - Function<bool s_Dialog(Critter&,Scenery&,int,Item@)> in module<scenery> not found, result<-6>.
[03:484] ProtoMap::BindSceneryScript - Map<pid<504>, name<farm1>>, Can't bind scenery function<s_Dialog> in module<scenery>. Scenery hexX<157>, hexY<122>.
[03:484] Script::Bind - Function<bool s_Dialog(Critter&,Scenery&,int,Item@)> in module<scenery> not found, result<-6>.
[03:484] ProtoMap::BindSceneryScript - Map<pid<504>, name<farm1>>, Can't bind scenery function<s_Dialog> in module<scenery>. Scenery hexX<82>, hexY<86>.
[03:484] Script::Bind - Function<void t_NpcMessageShout(Critter&,Scenery&,bool,uint8,int)> in module<trigger> not found, result<-6>.
[03:484] ProtoMap::BindSceneryScript - Map<pid<504>, name<farm1>>, Can't bind scenery function<t_NpcMessageShout> in module<trigger>. Scenery hexX<81>, hexY<115>.
[03:484] Script::Bind - Function<void t_NpcMessageShout(Critter&,Scenery&,bool,uint8,int)> in module<trigger> not found, result<-6>.
[03:484] ProtoMap::BindSceneryScript - Map<pid<504>, name<farm1>>, Can't bind scenery function<t_NpcMessageShout> in module<trigger>. Scenery hexX<82>, hexY<115>.
[03:484] Script::Bind - Function<void t_NpcMessageShout(Critter&,Scenery&,bool,uint8,int)> in module<trigger> not found, result<-6>.
[03:484] ProtoMap::BindSceneryScript - Map<pid<504>, name<farm1>>, Can't bind scenery function<t_NpcMessageShout> in module<trigger>. Scenery hexX<82>, hexY<114>.
[03:506] Load maps prototypes complete, loaded<271> protos.
[03:507] Load locations prototypes...
[03:510] MapManager::LoadLocationProto - Proto map is not loaded, location pid<127>, name<e_mountain7>.
[03:510] Load location<127> fail.

I need help in last update I can't run my server :/

Re: FOnline SDK - Question
« Reply #87 on: January 05, 2011, 07:10:07 pm »
What revision number is that? Looks like the server failed to load a map.Did you try searching if you have the map or to control if its there?

Offline barter1113

  • New Vegas fanatic =)
Re: FOnline SDK - Question
« Reply #88 on: January 05, 2011, 08:21:59 pm »
Delete
Code: [Select]
e_mountain7 map from locations.cfg

I have a question. How can I make quest? I know how to do easy dialogs but I don't know how works quests.

Offline barter1113

  • New Vegas fanatic =)
Re: FOnline SDK - Question
« Reply #89 on: January 06, 2011, 10:16:14 am »
Up, how can I make easy quest like bring me x items?