TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
  • Total Members: 3,963
  • Latest: BiZaJe
Stats
  • Total Posts: 195,917
  • Total Topics: 21,308
  • Online today: 884
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 310
  • Total: 310

Americas army server block help

Started by knight111, August 20, 2006, 06:26:53 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

knight111

for the donations block ... yeah sure give me a few to find it ... and ill upload and link it

knight111

ok here it is ... it called Nuke treasury

http://acesarmy.com/main/downloads/NukeTreasury.zip

hope this helps ... need anything else ... just shout

Thurnok

Quote from: Mrs G6 on August 21, 2006, 08:21:50 AM
Thank you for this Turnok :)
I knew you could pull it off :)

No problem G6.  Not sure what prompted you to send that one to me, but you can anytime.  :)

I see Ich is already looking into the other one so I'll leave that one to him.  Instead I think I'll enhance the AA server block.  Since all the info is transfered as part of the socket functions, I think I'll make a link that pops up the info in a table for the rest of the information it passes.

G6Cad

I have seen what you have done so far in here, and you seem to like being at service with those kind of things, so thats the reason i thought you might pull it off for him and others that want to use it in SMF and TP :)

Again thanks for helping us here :)

knight111

ok the Server scroller i link for ya was the right one but didnt have the 4 newest maps ... so i added the code and maps into it so here is the code with the added 4 .... and ill zip the map pack for ya ... just incase u want to pass it around or if anyone asks that way they have all maps working ... thx again .. its working great

4 maps added were



Border
Dusk
SF Dockside
SF Extraction



//////////////////////////////////////////////
// America's Army Server Info Block
// based on the PHP Nuke block designed by DivideByZero
//
// Redesigned and converted by Ken McNicholas for TinyPortal block
// Complete Computer Services
// August 20, 2006
//
// TinyPortal 0.86 with SMF 1.1 RC2
//
// The America's Army Server Info Block displays current players
// on a particular America's Army server.
// Set up the configuration info for the server you wish to query
//
//////////////////////////////////////////////

/*
****************************************
****************************************
*** !! User Configuration Section !! ***
****************************************
****************************************
*/

// Server IP you want to query
$aa_ip = '8.6.76.34';
// Server Name
$aa_server_name = 'aces server';
$aa_server_url = 'http://www.forwardobserver.us/browser/foserverlist.php?ServerIP=';
$aa_lookup_server = 'http://www.aa-mbs.com/serverlookup.php?ip=' . $aa_ip . ':1716';

// Server Port - 1717 = default
$aa_port = '1717';

// URL to where you put the folder containing the map pics (include a trailing slash!)
$aa_image_path = 'http://www.acesarmy.com/forum/server/armygame/';

// You should only need to change the map array if maps
// are added/deleted/changed, otherwise leave as is
$map = array("Bridge Crossing" => "Bridge.jpg",
"Bridge SE" => "Bridge SE.jpg",
"Border" => "Border.jpg",
"Collapsed Tunnel" => "Tunnel-d.jpg",
"Dusk" => "Dusk.jpg",
"FLS Assault" => "FLS-b.jpg",
"Headquarters Raid" => "HQ_Raid.jpg",
"Insurgent Camp" => "Insurgent_Camp-c.jpg",
"JRTC Farm Raid" => "JRTC_Farm.jpg",
"Mountain Ambush" => "Mountain_Ambush-b.jpg",
"Mountain Pass" => "Mountain_Pass.jpg",
"Mountain Pass SE" => "Mountain Pass SE.jpg",
"Mout McKenna" => "MOUT_McKenna.jpg",
"Pipeline" => "Pipeline-b.jpg",
"Pipeline SF" => "Pipeline.jpg",
"Radio Tower" => "Radio_Tower.jpg",
"River Basin" => "River_Basin-c.jpg",
"SF Oasis" => "sf_oasis.jpg",
"SF Taiga" => "sf_taiga.jpg",
"SF Blizzard" => "sf_blizzard.jpg",
"SF Courtyard" => "sf_courtyard.jpg",
"SF Dockside" => "SFdockside.jpg",
"SF Extraction" => "SFextraction.jpg",
"SF PCR" => "sf_pcr.jpg",
"SF Water Treatment" => "sf_water_treatment.jpg",
"SF Arctic" => "sfarctic.jpg",
"SF Village" => "sfvillage.jpg",
"SF CSAR" => "sf_csar.jpg",
"SF Hospital" => "sf_hospital.jpg",
"SF Recon" => "sf_recon.jpg",
"SF SandStorm" => "sf_sandstorm.jpg",
"Swamp Raid" => "Swamp_Raid-a.jpg",
"Weapons Cache" => "Weapons_Cache-d.jpg",
"Weapons Cache SE" => "Weapons_Cache-a.jpg",
"Woodland Outpost" => "woodland_outpost.jpg",
"Urban Assault" => "urban_assault.jpg");
                                   
/*
****************************************
****************************************
*/

//////////////////////////////////////////////
//
// The rest of this you should leave as is
// unless you are overly industrious :)
//
//////////////////////////////////////////////

// query server for game info
$aa_sock = fsockopen( "udp://" . $aa_ip, $aa_port);
if($aa_sock != false){
socket_set_timeout($aa_sock, 0, 500000);
fwrite($aa_sock, "\\info\\");
$aa_info = @fread($aa_sock, 8192);
fclose($aa_sock);
}

// create array to hold game info
$aa_infoarr = explode("\\", $aa_info);
$aa_info = array();
$aa_infosize = count($aa_infoarr);
// since first element is unused (element 0) start at element 1
// and populate an associative array (nicer, and easier!)
for ($i = 1; $i < $aa_infosize; $i += 2){
$aa_info[$aa_infoarr[$i]] = $aa_infoarr[$i+1];
}

// get player list
$players = "";
$p = 1;
for ($i = 0; $i < $aa_info['numplayers']; $i++){
$players .= $p . ' - ' . $aa_info['player_' . $i] . '<br />';
$p++;
}

// display info
// Host name and link to detail from FO Online Server Browser
echo '<a href="' . $aa_server_url . $aa_ip . '">' . $aa_info['hostname'] . "</a><br />";
//IP:Port address
echo 'IP: ' . $aa_ip . ':' . $aa_port . '<br />';
// Map Name
echo 'Map: ' . $aa_info['mapname'] . '<br />';
// Players / Max Players
echo 'Players: ' . $aa_info['numplayers'] . '/' . $aa_info['maxplayers'] . '<br />';
// Round
echo 'Round: ' . $aa_info['current_round'] . '<br />';
//Mission Time
echo 'Time: ' . $aa_info['mission_time'] . '<br />';

$mappic = "";
if (array_key_exists($aa_info['mapname'], $map)){
echo '<img src="' . $aa_image_path . $map[$aa_info['mapname']] . '"><br />';
} else {
echo 'Map Unavailable!<br />';
}
echo '<a href="' . $aa_lookup_server . '">* Server Intel *</a><br />';
echo '<a href="aao://' . $aa_ip . '"><img src="' . $aa_image_path . 'joinserver.gif" border="0" alt="Join Server!!"></a><br />';
echo 'Current Players:<br />';
echo '<a name="scrollingCode"></a>';
// display scrolling player list
echo '<marquee behavior="scroll" align="left" direction="up" height="80" width="90%" scrollamount="2" scrolldelay="100" bgcolor="232323"
loop="infinite" onmouseover="this.stop()" onmouseout="this.start()">';
echo '<a href="' . $aa_lookup_server . '">' . $players . '</a></marquee>';

Thurnok

Thanks.  Yes, I try to keep all the necessary files with any project, so definately a good thing to have!  Thanks Knight!

mebymyself

Hi Thurnok,

I installed this on my site - worked like charm!
Thank you a lot for great code.

I have one little issue
when server name contains color codes those codes are not shown correctly (which make perfect sence)
The color code is 4byte code with first byte - is escape code chr(27) or chr(&H1B)   and other 3 is hex RGB values
ex. 1BFFFF66

I tried to remve this code but due to lack of PHP knoladge end up with this code (which is not working)


$in_str=chr(27) . 'ÃÆ'Ã,¿ÃÆ'Ã,¿fSAMPLE Server name';

$out_str='';

echo $in_str;

for ($i = 1; $i <= strlen($in_str); $i++) {

if $in_str{$i}==chr(27)
{

$i = $i + 4;
}

else
{
$out_str .= $in_str{$i};

}

};

echo $out_str;



can you fix it and maybe update your code so it shows server name "colorless"?

insanemustang

Quote from: Thurnok on August 21, 2006, 01:11:16 AM
Here you go!

Place the attached files somewhere on your server.  Next, put the following code into a phpblock:

//////////////////////////////////////////////
// America's Army Server Info Block
// based on the PHP Nuke block designed by DivideByZero
//
// Redesigned and converted by Ken McNicholas for TinyPortal block
// Complete Computer Services
// August 20, 2006
//
// TinyPortal 0.86 with SMF 1.1 RC2
//
// The America's Army Server Info Block displays current players
// on a particular America's Army server.
// Set up the configuration info for the server you wish to query
//
//////////////////////////////////////////////

/*
****************************************
****************************************
*** !! User Configuration Section !! ***
****************************************
****************************************
*/

// Server IP you want to query
$aa_ip = '8.6.76.34';
// Server Name
$aa_server_name = 'aces server';
$aa_server_url = 'http://www.forwardobserver.us/browser/foserverlist.php?ServerIP=';
$aa_lookup_server = 'http://www.aa-mbs.com/serverlookup.php?ip=' . $aa_ip . ':1716';

// Server Port - 1717 = default
$aa_port = '1717';

// URL to where you put the folder containing the map pics (include a trailing slash!)
$aa_image_path = 'http://www.yourdomain.com/pathtoimages/';

// You should only need to change the map array if maps
// are added/deleted/changed, otherwise leave as is
$map = array("Bridge Crossing" => "Bridge.jpg",
"Bridge SE" => "Bridge SE.jpg",
"Collapsed Tunnel" => "Tunnel-d.jpg",
"FLS Assault" => "FLS-b.jpg",
"Headquarters Raid" => "HQ_Raid.jpg",
"Insurgent Camp" => "Insurgent_Camp-c.jpg",
"JRTC Farm Raid" => "JRTC_Farm.jpg",
"Mountain Ambush" => "Mountain_Ambush-b.jpg",
"Mountain Pass" => "Mountain_Pass.jpg",
"Mountain Pass SE" => "Mountain Pass SE.jpg",
"Mout McKenna" => "MOUT_McKenna.jpg",
"Pipeline" => "Pipeline-b.jpg",
"Pipeline SF" => "Pipeline.jpg",
"Radio Tower" => "Radio_Tower.jpg",
"River Basin" => "River_Basin-c.jpg",
"SF Oasis" => "sf_oasis.jpg",
"SF Taiga" => "sf_taiga.jpg",
"SF Blizzard" => "sf_blizzard.jpg",
"SF Courtyard" => "sf_courtyard.jpg",
"SF PCR" => "sf_pcr.jpg",
"SF Water Treatment" => "sf_water_treatment.jpg",
"SF Arctic" => "sfarctic.jpg",
"SF Village" => "sfvillage.jpg",
"SF CSAR" => "sf_csar.jpg",
"SF Hospital" => "sf_hospital.jpg",
"SF Recon" => "sf_recon.jpg",
"SF SandStorm" => "sf_sandstorm.jpg",
"Swamp Raid" => "Swamp_Raid-a.jpg",
"Weapons Cache" => "Weapons_Cache-d.jpg",
"Weapons Cache SE" => "Weapons_Cache-a.jpg",
"Woodland Outpost" => "woodland_outpost.jpg",
"Urban Assault" => "urban_assault.jpg");

/*
****************************************
****************************************
*/

//////////////////////////////////////////////
//
// The rest of this you should leave as is
// unless you are overly industrious :)
//
//////////////////////////////////////////////

// query server for game info
$aa_sock = fsockopen( "udp://" . $aa_ip, $aa_port);
if($aa_sock != false){
socket_set_timeout($aa_sock, 0, 500000);
fwrite($aa_sock, "\\info\\");
$aa_info = @fread($aa_sock, 8192);
fclose($aa_sock);
}

// create array to hold game info
$aa_infoarr = explode("\\", $aa_info);
$aa_info = array();
$aa_infosize = count($aa_infoarr);
// since first element is unused (element 0) start at element 1
// and populate an associative array (nicer, and easier!)
for ($i = 1; $i < $aa_infosize; $i += 2){
$aa_info[$aa_infoarr[$i]] = $aa_infoarr[$i+1];
}

// get player list
$players = "";
$p = 1;
for ($i = 0; $i < $aa_info['numplayers']; $i++){
$players .= $p . ' - ' . $aa_info['player_' . $i] . '<br />';
$p++;
}

// display info
// Host name and link to detail from FO Online Server Browser
echo '<a href="' . $aa_server_url . $aa_ip . '">' . $aa_info['hostname'] . "</a><br />";
//IP:Port address
echo 'IP: ' . $aa_ip . ':' . $aa_port . '<br />';
// Map Name
echo 'Map: ' . $aa_info['mapname'] . '<br />';
// Players / Max Players
echo 'Players: ' . $aa_info['numplayers'] . '/' . $aa_info['maxplayers'] . '<br />';
// Round
echo 'Round: ' . $aa_info['current_round'] . '<br />';
//Mission Time
echo 'Time: ' . $aa_info['mission_time'] . '<br />';

$mappic = "";
if (array_key_exists($aa_info['mapname'], $map)){
echo '<img src="' . $aa_image_path . $map[$aa_info['mapname']] . '"><br />';
} else {
echo 'Map Unavailable!<br />';
}
echo '<a href="' . $aa_lookup_server . '">* Server Intel *</a><br />';
echo '<a href="aao://' . $aa_ip . '"><img src="' . $aa_image_path . 'joinserver.gif" border="0" alt="Join Server!!"></a><br />';
echo 'Current Players:<br />';
echo '<a name="scrollingCode"></a>';
// display scrolling player list
echo '<marquee behavior="scroll" align="left" direction="up" height="80" width="90%" scrollamount="2" scrolldelay="100" bgcolor="232323"
loop="infinite" onmouseover="this.stop()" onmouseout="this.start()">';
echo '<a href="' . $aa_lookup_server . '">' . $players . '</a></marquee>';


Next, configure the code above for your information.  I don't know if there are other servers you can grab the info from, but you will definately need to set the $aa_image_path variable to the URL you can get to the images you place on your server.

NOTE: Your Host provider must allow the fsockopen() php function on your server otherwise you will get no data.  Not all Host providers allow this function.  Talk to your Host provider about allowing it if they do not already.


Will doing those things allow me to display info for any gaming servers, like cod2 or bf2?

mebymyself

Not it shows only America's Army Server info

mebymyself

Here is it! I made it by myself


//////////////////////////////////////////////
// America's Army Server Info Block
// based on the PHP Nuke block designed by DivideByZero
//
// Redesigned and converted by Ken McNicholas for TinyPortal block
// Complete Computer Services
// August 20, 2006
//
// TinyPortal 0.9.5 with SMF 1.1 RC3
//
// The America's Army Server Info Block displays current players
// on a particular America's Army server.
// Set up the configuration info for the server you wish to query
//
//////////////////////////////////////////////

function cleanup($string){
     $done = false;
     $count=0;
     while($done == false){
          $out = unpack("H*", $string);
          $pos = strpos($out[1], "1b");
          $len = "4";
         
          if ($pos === false){
               $done = true;
               break;
          }
          $count++;

          /* Calc true position */
          if($pos == 0){
               $loc = $pos;
          }else{
               $loc = $pos / 2;
          }

         $color=join(unpack("H*", substr($string, $loc+1, $len-1)))   ;
                 
             
         $substr='<' . 'font color="#' . $color . '">' ;
         $string = substr_replace($string, $substr, $loc, $len);


     }
     
while ( $count>0 ){
    $string = $string  . '<'  .'/font'.  '>' ;
    $count-- ;
  }
     return $string;
}


/*
****************************************
****************************************
*** !! User Configuration Section !! ***
****************************************
****************************************
*/

// Server IP you want to query
$aa_ip = '127.0.0.1';
// Server Name
$aa_server_name = 'YourServerNameGoesHere;
$aa_server_url = 'http://www.forwardobserver.us/browser/foserverlist.php?ServerIP=';
$aa_lookup_server = 'http://www.aa-mbs.com/serverlookup.php?ip=' . $aa_ip . ':1716';

// Server Port - 1717 = default
$aa_port = '1717';

// URL to where you put the folder containing the map pics (include a trailing slash!)
$aa_image_path = 'aaomaps/';

// You should only need to change the map array if maps
// are added/deleted/changed, otherwise leave as is

// New maps added Steamroller, SF SnakePlain, Interdiction
$map = array("Bridge Crossing" => "Bridge.jpg",
"Bridge SE" => "Bridge SE.jpg",
"Border" => "Border.jpg",
"Collapsed Tunnel" => "Tunnel-d.jpg",
"Dusk" => "Dusk.jpg",
"FLS Assault" => "FLS-b.jpg",
"Headquarters Raid" => "HQ_Raid.jpg",
"Insurgent Camp" => "Insurgent_Camp-c.jpg",
             
             "Interdiction" =>"interdiction.jpg",
"JRTC Farm Raid" => "JRTC_Farm.jpg",
"Mountain Ambush" => "Mountain_Ambush-b.jpg",
"Mountain Pass" => "Mountain_Pass.jpg",
"Mountain Pass SE" => "Mountain Pass SE.jpg",
"Mout McKenna" => "MOUT_McKenna.jpg",
"Pipeline" => "Pipeline-b.jpg",
"Pipeline SF" => "Pipeline.jpg",
"Radio Tower" => "Radio_Tower.jpg",
"River Basin" => "River_Basin-c.jpg",
"SF Oasis" => "sf_oasis.jpg",
"SF Taiga" => "sf_taiga.jpg",
"SF Blizzard" => "sf_blizzard.jpg",
"SF Courtyard" => "sf_courtyard.jpg",
"SF Dockside" => "SFdockside.jpg",
"SF Extraction" => "SFextraction.jpg",
"SF PCR" => "sf_pcr.jpg",
"SF Water Treatment" => "sf_water_treatment.jpg",
"SF Arctic" => "sfarctic.jpg",
"SF Village" => "sfvillage.jpg",
"SF CSAR" => "sf_csar.jpg",
"SF Hospital" => "sf_hospital.jpg",
"SF Recon" => "sf_recon.jpg",
"SF SandStorm" => "sf_sandstorm.jpg",

             "SF SnakePlain" => "sf_snakeplain.jpg",
             
             "Steamroller" => "steamroller.jpg",
"Swamp Raid" => "Swamp_Raid-a.jpg",
"Weapons Cache" => "Weapons_Cache-d.jpg",
"Weapons Cache SE" => "Weapons_Cache-a.jpg",
"Woodland Outpost" => "woodland_outpost.jpg",
"Urban Assault" => "urban_assault.jpg");
                                   
/*
****************************************
****************************************
*/

//////////////////////////////////////////////
//
// The rest of this you should leave as is
// unless you are overly industrious :)
//
//////////////////////////////////////////////

// query server for game info
$aa_sock = fsockopen( "udp://" . $aa_ip, $aa_port);
if($aa_sock != false){
socket_set_timeout($aa_sock, 0, 500000);
fwrite($aa_sock, "\\info\\");
$aa_info = @fread($aa_sock, 8192);
fclose($aa_sock);
}

// create array to hold game info
$aa_infoarr = explode("\\", $aa_info);
$aa_info = array();
$aa_infosize = count($aa_infoarr);
// since first element is unused (element 0) start at element 1
// and populate an associative array (nicer, and easier!)
for ($i = 1; $i < $aa_infosize; $i += 2){
$aa_info[$aa_infoarr[$i]] = $aa_infoarr[$i+1];
}

// get player list
$players = "<br /><br />";
$p = 1;
for ($i = 0; $i < $aa_info['numplayers']; $i++){
$players .= $p . ' ' . $aa_info['player_' . $i] . '<br />';
$p++;
}
$players .='<br /><br />';

// display info

// Host name and link to detail from FO Online Server Browser
echo '<center><a href="' . $aa_server_url . $aa_ip . '">' . cleanup($aa_info['hostname']) . "</a><br />";
//IP:Port address
echo 'IP: ' . $aa_ip . ':' . $aa_port . '<br />';
// Map Name
echo 'Map: ' . $aa_info['mapname'] . '<br />';
// Players / Max Players
echo 'Players: ' . $aa_info['numplayers'] . '/' . $aa_info['maxplayers'] . '<br />';
// Round
echo 'Round: ' . $aa_info['current_round'] . '<br />';
//Mission Time
echo 'Time: ' . $aa_info['mission_time'] . '<br />';

$mappic = "";
if (array_key_exists($aa_info['mapname'], $map)){
echo '<img src="' . $aa_image_path . $map[$aa_info['mapname']] . '"><br />';
} else {
echo 'Map Unavailable!<br />';
}
echo '<a href="' . $aa_lookup_server . '">* Server Intel *</a><br />';
echo '<a href="aao://' . $aa_ip . '"><img src="' . $aa_image_path . 'joinserver.gif" border="0" alt="Join Server!!"></a><br />';
echo 'Current Players:<br />';
echo '<a name="scrollingCode"></a>';
// display scrolling player list
echo '<marquee behavior="scroll" align="left" direction="up" height="80" width="90%" scrollamount="2" scrolldelay="100" bgcolor="232323"
loop="infinite" onmouseover="this.stop()" onmouseout="this.start()">';
echo '<a href="' . $aa_lookup_server . '">' . $players . '</a></marquee></center>';



This website is proudly hosted on Crocweb Cloud Website Hosting.