Tremulous Forum

Mods => Modding Center => Topic started by: doomagent13 on May 30, 2007, 12:50:58 am

Title: !listmaps
Post by: doomagent13 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.
Title: !listmaps
Post by: Rawr on May 30, 2007, 02:08:35 am
Not bad ;)
Title: !listmaps
Post by: PFB on May 30, 2007, 07:42:16 am
devmap [tab]
if you dont have the map changing it is pointless
sorry dude
Title: !listmaps
Post by: Undeference on May 30, 2007, 07:45:59 am
Or you can do it closer to doomagent13's code:
/dir maps .bsp
Title: !listmaps
Post by: benmachine 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.
Title: !listmaps
Post by: doomagent13 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.
Title: !listmaps
Post by: Undeference 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)?
Title: !listmaps
Post by: doomagent13 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.
Title: !listmaps
Post by: PFB 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
Title: !listmaps
Post by: doomagent13 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.
Title: !listmaps
Post by: Paradox 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.