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 .
//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",
""
},
//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.