Map listing

Started by Rabbi Bob, July 22, 2004, 10:45:09 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Rabbi Bob

Posted this elsewhere for FoCA & CoFR use, and I know you guys have your map list, but in the spirit of sharing, I post this.

Best,
Bob

-------

Been in a funk this past week, so I wanted to try something different to get my mind elsewhere.  Here it is, very hack and probably full of holes.  Written and run under ActivePerl for Win, but should be immediately fit for Linux use.   Works for me, your mileage may vary.  Feel free to use, hack, rewrite or ignore at your leisure.

What does it do?

Logs into your cstrike server, assumes that your path from logging into the server is then to cd cstrike\maps to get to your bsp files.  Then reads the contents, spits them out into a text file which you can then paste into a forum post.  It contains the formatting and url links to a google search with mapname.zip+download for the viewer, like so:

P&B Map List

as_courthouse   as_ghetto     as_oilrig  as_tundra     bl_shotgun     cs_52sevilla
  cs_52villabacho   cs_747  cs_arcticbase  cs_assault  cs_assault_upc  cs_assault2k
   cs_backalley  cs_beirut      cs_bikini    cs_boxoffice2k   cs_bro  cs_bwinter
 cs_club42   cs_deagle5  cs_docks     cs_duke2k  cs_estate  cs_havana
 cs_italy  cs_militia  cs_office  cs_place4  cs_rio    cs_shipjack
 cs_siege  cs_siege_apc  cs_snowflake  cs_thunder       cs_tire      cs_trkstp
  cs_wildwest_assault   cs_winter_assault  cs_wpndepot  de_52andalusia   de_52casco   de_52castello
  de_52costadelsol   de_52lagranja   de_52leon   de_52mangana   de_52puente   de_52spania
  de_airstrip de_aztec   de_aztec3     de_bahrain   de_burscheid   de_cbble
  de_centurion  de_chateau  de_clan1_mill de_clan2_fire  de_daft  de_dawn
   de_deadlock   de_deep6  de_dust   de_dust2   de_dustbunnies    de_frankzoo
   de_frostbound  de_gijoe  de_gijoe2   de_heat    de_herrenberg  de_inferno
   de_keller  de_keller_2k  de_luxor  de_maya   de_motel_x  de_museum
  de_night  de_nuke  de_osaka_beta1   de_outrage  de_piranesi  de_predator
 de_prodigy  de_prodigy2k  de_railroad  de_rats  de_ratsxl     de_rock
  de_rotterdam  de_scud_2k1  de_silentoperation   de_simpsons   de_storm  de_storm2
  de_survivor  de_torn  de_tot  de_train  de_vegas     de_vertigo
 de_winterdust  de_winternuke  dm_sgarena   es_trinity   fy_pumpalley     mindmaze
   scoutzknivez  slap_pistols   speedball2k1 treefort1

Total maps: 112


#!/usr/bin/perl

use Net::FTP;

$host="ip";
$username="username";
$password="pass";
$servername="Your Server Here";

$remotedir1="/cstrike/maps";

my $ftp = Net::FTP->new("$host") or die "Can't connect: $@\n";
$ftp->login($username, $password) or die "Couldn't login\n";
$ftp->cwd("$remotedir1")  or die "Couldn't change directory to $remotedir1\n";
$PWD=$ftp->pwd;

$out="$servername_mapslist.txt";

open OUT, ">$out" or die "Cannot open $out for write :$!";
print OUT "[b]$servername Map List[/b]\n\n";

print"$PWD\n";
$ftp->type('I');

$LOGDOESNOTEXIST=3;

my @LOGFiles = $ftp->ls();

$total=0;
$zip="zip";
$tempname="";
$URLend="[/url]";
$download="+download";

foreach $LOGfile (@LOGFiles)
{
    $tempname=$LOGfile;
    chop $tempname;
    chop $tempname;
    chop $tempname;
    chop $tempname;
    if ($LOGfile=~"bsp")
      {
      if ($LOGfile!~"ztmp")
        {
        print OUT "[url=http://www.google.com/search?hl=en&ie=UTF-8&q=$tempname.$zip$download]$tempname$URLend";
        $counter++;
         $total++;
        }
      }
    if ($counter<6)
      {
      print OUT " ";
      }
    if ($counter==6)
      {
      print OUT "\n";
      $counter=0;
      }
    }

print OUT "\n\nTotal maps: $total\n\n";

Needs PERL to run.  Save as a *.pl script and run as needed.  Edit the top variables to match your server's ftp info.
#!/usr/bin/admin
use warnings;
use strict;
use boot;

Bob is: working on A.T.L.A.S. HL

OldBloke

N1 RB.

I've used ASP to put our current rotations on our website but I'm gonna steal your excellent Google search idea. :thumb:
"War without end. Well, what was history if not that? And how would having the stars change anything?" - James S. A. Corey