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: 205
  • Total: 205

[Block ] Americas army server block help

Started by Hairy, July 19, 2007, 03:23:22 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

iGate

omega it shud work. ar is using it, but i think rem might have modified it to use aaotracker instead of forward observer.

Omega-

ohk... I logged onto the forums this morning and it was magically all working :D

I think dan mighta get rem to slightly mod it... tho Lt Arrow tryed it with [Nifty] Melbourne and it didnt work... I think theres some sorta random thing going on with 2.5 servers... Its not just our game server

Thurnok

@ iGate - At one point in time, I believe it was able to work in a php article.  I cannot test it any longer either.  However, you definately do not want to have it in both a block and an article being shown on the page at the same time.  That will cause issues.

brianjw

Sorry to bump this, but what happened to the attachments under Thurnok's post on the first page. I am interested in this script. Could you repost the attachments?

IchBin

In the server move we lost quite a few attachments. Thurnok is on an extended break. The only way you'll get it I think is if someone else has it.

brianjw

Ahh ok. Thanks IchBin. I think the files attached were only images of the server maps anyway. :)

Hairy

I have updated this snippet:

*Changed the link from forward observer to aao tracker
*Updated map listing to be current

I have also attached the maps I am using (make sure you login to see the attachment).

:coolsmiley:

//////////////////////////////////////////////
// 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 = 'XXX.XXX.XXX.XXX';
// Server Name
$aa_server_name = 'INSERT NAME TO SHOW HERE';
$aa_server_url = 'http://aaotracker.com/webspec/index.php?addr=';
$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_crossing.jpg",
"Bridge SE" => "bridge_se.jpg",
"Border" => "border.jpg",
"Canyon" => "canyon.jpg",
"Collapsed Tunnel" => "collapsed_tunnel.jpg",
"District" => "district.jpg",
"Dusk" => "dusk.jpg",
"ES2Border" => "es2_border.jpg",
"FLS Assault" => "fls_assault.jpg",
"Headquarters Raid" => "headquarters_raid.jpg",
"Insurgent Camp" => "insurgent_camp.jpg",
"Interdiction" => "interdiction.jpg",
"JRTC Farm Raid" => "jrtc_farm_raid.jpg",
"Mountain Ambush" => "mountain_ambush.jpg",
"Mountain Pass" => "mountain_pass.jpg",
"Mountain Pass SE" => "mountain_pass_se.jpg",
"Mout McKenna" => "mout_mckenna.jpg",
"Oil Rig" => "oil_rig.jpg",
"OperationShroudedEagle" => "shrouded_eagle.jpg",
"Pipeline" => "pipeline.jpg",
"SF Pipeline" => "pipeline_sf.jpg",
"Radio Tower" => "radio_tower.jpg",
"River Basin" => "river_basin.jpg",
"SMU GH RiverVillage" => "river_village.jpg",
"Rummage" => "rummage.jpg",
"Steamroller" => "steamroller.jpg",
"SF Arctic" => "sf_arctic.jpg",
"SF Oasis" => "sf_oasis.jpg",
"SF Taiga" => "sf_taiga.jpg",
"SF Blizzard" => "sf_blizzard.jpg",
"SF Courtyard" => "sf_courtyard.jpg",
"SF Dockside" => "sf_dockside.jpg",
"SF Extraction" => "sf_extraction.jpg",
"SF PCR" => "sf_pcr.jpg",
"SF Water Treatment" => "sf_water_treatment.jpg",
"SF Village" => "sf_village.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",
"SMU GH SFFloodgate" => "sf_floodgate.jpg",
"SMU GH SFRefinery" => "sf_refinery.jpg",
"SMU GH SFOldTown" => "sf_old_town.jpg",
"Swamp Raid" => "swamp_raid.jpg",
"Weapons Cache" => "weapons_cache.jpg",
"Weapons Cache SE" => "weapons_cache_se.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 . ':1716">' . $aa_server_name . "</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 '<img src="' . $aa_image_path . 'unknown.jpg">';
}
echo '<a href="' . $aa_lookup_server . '">* Server Intel *</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>';

G6Cad

Can you update the first post with this instead ?  It's easier to find when the first post always holds the newest code available  :up:  :)

[EDIT]
See that you are not the topic starter, so i think a new topic with your code is better :)

Hairy

#28
Hi G6, my first post was on page 3 but I have edited with a link to the above info so it's easier for others to find, if and Admin can link to it by editing the first post that would be excellent!  :D

http://www.tinyportal.net/index.php/topic,7628.msg144888.html#msg144888

Hope all is well, been a while since I have been here but I always make sure I post anything I think would help others.

Cheers  :)

EDIT: A new topic might be good but this topic is linked on the "snippets index" so maybe a moderater can edit the first post to link to the one I just posted? Let me know if you still want a new topic and I will do it.

G6Cad

I splitted the topic instead.
Edit the first post with some text explaining what it is and you can hold this topic updated as you like  :up:

This website is proudly hosted on Crocweb Cloud Website Hosting.