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

[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.

AndersAnd

Quote from: Thurnok on July 18, 2007, 07:19:08 AM
The links in the block code?  Those are from a server that was running at one time that may or may not still be up.  You will need to provide a valid server and port for use of the block itself.

Thurnok  i cant find thatblock on Tiny portal :-( is it me ore don't u have it anymore ?


RBakker

Quote from: AndersAnd on July 22, 2007, 02:22:20 PM
Quote from: Thurnok on July 18, 2007, 07:19:08 AM
The links in the block code?  Those are from a server that was running at one time that may or may not still be up.  You will need to provide a valid server and port for use of the block itself.

Thurnok  i cant find thatblock on Tiny portal :-( is it me ore don't u have it anymore ?



Andersand ; it is a codeblock shown in 3 versions in this topic. Otherwise You can find it at n Turnoks homepage.

iGate

how can i convert this script so that it will work in an article?

IchBin

No need to convert it, just put it in a PHP article.

iGate


//////////////////////////////////////////////
// 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 = '64.34.201.157';
// 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>';


i got this to work in a php BLOCK but it wont work in a php article for me.
this is a link to the article: http://ihf.lp.pl/index.php?page=32
the block is on the right, as u will see it is working.
The code i posted above is what im using

iGate

to help you.

what i am trying to do is create a similar thing to this:
http://www.draat.net/servers

thats why i want to put it in an article. once in an article i want to organise it so that it is in columns.

IchBin

Well it should work if it works in a block. I have no way of testing it, so there's not much I can do. Sorry.

Omega-

Hey,

I just installed this on my site but looking at the code it no longer works because forwardobserver.com does not exist anymore...

If i am not wrong, the information it gets is from forward observer... You guys are intelligent and get the picture now despite all my ramblings :)

Is it just a matter of changing a lil something round in the code or would the code have to be re-written to work...?

Thank You in advance for help.

Dazed

Go here.... http://www.airdaleops.com/index.php

They are using the block in question for the servers. You could pm Yapple and get the code. I had it here but can't find it now. Not sure if those are the type of blocks you desire but I assume they are using a different method to query the servers...

Omega-

#19
I am pretty sure this doesnt work any more for 2.5 servers...because that server tracker gets its info from aa-mbs.com

For 2.5 to work it needs to get its info from game-monitor.com.... :(

Maybe ill ask iGate for a some advise

This website is proudly hosted on Crocweb Cloud Website Hosting.