Author Topic: !listmaps  (Read 7421 times)

doomagent13

  • Posts: 506
  • Turrets: +18/-18
!listmaps
« on: May 30, 2007, 12:50:58 am »
This is a simple admin command that lists the names of the .bsp files contained on the server.  IT DOES NOT LIST THE NAMES OF THE .PK3s.

Both of these code fragments go in g_admin.c .

Code: [Select]
//The little bit that goes in the admin command list thing
    {"listmaps", G_admin_listmaps, "i",
 "display a list of all maps on the server available for map votes",
 ""
},

Code: [Select]
//The method that goes else where in g_admin.c
qboolean G_admin_listmaps(gentity_t *ent, int skiparg)
{
  char fileList[ ( MAX_CVAR_VALUE_STRING / 2 ) * 5 ] = {""};
  int numFiles, i, fileLen = 0;
  char *filePtr;

  ADMP("^3!listmaps:^7 server has maps:\n");
  numFiles = trap_FS_GetFileList( "maps", ".bsp",
    fileList, sizeof( fileList ) );
  filePtr = fileList;
  for( i = 0; i < numFiles; i++, filePtr += fileLen + 1 )
  {
    fileLen = strlen( filePtr );
ADMP(va("%s, ", filePtr));
  }
  ADMP("\n^3!listmaps:^7 for votes, do \\callvote map <mapname> in console\n");
  return qtrue;
}


Simple, but useful, particularly if there are custom/beta maps on the server.

Rawr

  • Posts: 918
  • Turrets: +1/-1
!listmaps
« Reply #1 on: May 30, 2007, 02:08:35 am »
Not bad ;)
img]http://dvclan.org/statsig/statsig.php/3826/4.jpg[/img]

PFB

  • Guest
!listmaps
« Reply #2 on: May 30, 2007, 07:42:16 am »
devmap [tab]
if you dont have the map changing it is pointless
sorry dude

Undeference

  • Tremulous Developers
  • *
  • Posts: 1254
  • Turrets: +122/-45
!listmaps
« Reply #3 on: May 30, 2007, 07:45:59 am »
Or you can do it closer to doomagent13's code:
/dir maps .bsp
Need help? Ask intelligently. Please share solutions you find.

Thats what we need, helpful players, not more powerful admins.

benmachine

  • Posts: 915
  • Turrets: +99/-76
    • ben's machinery
!listmaps
« Reply #4 on: May 30, 2007, 12:12:59 pm »
Quote from: "PFB"
devmap [tab]
if you dont have the map changing it is pointless
sorry dude

/callvote map

I think this could be a potentially very useful command, but I don't think an admin command is appropriate. You could try making it /maplist or displaying it when map *.bsp not found at callvote (have a look at g_cmds.c)

Also, what is this:
Code: [Select]
[ ( MAX_CVAR_VALUE_STRING / 2 ) * 5 ]
I'm not sure what you're aiming for here, or why MAX_CVAR_VALUE_STRING is relevant. MAX_OSPATH may be the number you are looking for.

edit: yes, you may be somewhat obsoleted by Undeference's suggestion.
benmachine

doomagent13

  • Posts: 506
  • Turrets: +18/-18
!listmaps
« Reply #5 on: May 30, 2007, 12:26:13 pm »
Quote from: "PFB"
devmap [tab]
if you dont have the map changing it is pointless
sorry dude
This is NOT supposed to tell you what maps YOU have--that would have to be a console command.  This is the server's maps that are available for vote, so no more name guessing.

Undeference

  • Tremulous Developers
  • *
  • Posts: 1254
  • Turrets: +122/-45
!listmaps
« Reply #6 on: May 30, 2007, 01:57:04 pm »
Quote from: "doomagent13"
Quote from: "PFB"
devmap [tab]
if you dont have the map changing it is pointless
sorry dude
This is NOT supposed to tell you what maps YOU have--that would have to be a console command.  This is the server's maps that are available for vote, so no more name guessing.
If sv_pure=1, you will not load pk3s that are not on the pure list. Most relevant non-pk3 files will also be ignored.
If the maps are votable on the server, they will be in the pure list. /dir maps .bsp will only list those files (same with /(dev)?map [tab]).

The question becomes what is more important: knowing what maps are on the server or knowing what maps you have that are on the server. Do you really want to "/callvote map reallycoolmap" only to find out that you now have to spend several minutes downloading the map that you could have spent exploring (or worse, getting kicked off the server and having to hunt for the map elsewhere)?
Need help? Ask intelligently. Please share solutions you find.

Thats what we need, helpful players, not more powerful admins.

doomagent13

  • Posts: 506
  • Turrets: +18/-18
!listmaps
« Reply #7 on: May 30, 2007, 03:23:36 pm »
Quote from: "benmachine"
I think this could be a potentially very useful command, but I don't think an admin command is appropriate. You could try making it /maplist or displaying it when map *.bsp not found at callvote (have a look at g_cmds.c)

Also, what is this:
Code: [Select]
[ ( MAX_CVAR_VALUE_STRING / 2 ) * 5 ]
This is actually a relatively minorly modified version of TJW's !listlayouts.  It could be made into a console command, but I think that it will be more noticed as an admin command because it will be mentioned by !help.

As far as listing YOUR maps, that would likely have to be either a client-console-command or a cgame-based-command, both of which are much more complicated, as they require a client-side download.  Maybe you didnt notice, but this is supposed to go in g_admin.c.

PFB

  • Guest
!listmaps
« Reply #8 on: May 30, 2007, 04:21:20 pm »
yes we should move everything to g_admin
I am still waiting for !god and !give commands

doomagent13

  • Posts: 506
  • Turrets: +18/-18
!listmaps
« Reply #9 on: May 30, 2007, 08:22:50 pm »
Quote from: "PFB"
yes we should move everything to g_admin
I am still waiting for !god and !give commands
It is not like you HAVE to use this.  If you want to have to guess about version numbering schemes, go ahead.  /god and /give require sv_cheats 1 to work, so making them admin commands would be less than useless.

Paradox

  • Posts: 2612
  • Turrets: +253/-250
    • Paradox Designs
!listmaps
« Reply #10 on: May 30, 2007, 10:52:29 pm »
A useful easy to implement thing for any server owner is just creating an info file for maps, and dumping the map names into the file.

Works for me.

∧OMG ENTROPY∧