1 // Property of Alientrap/AK
2 // custom/creategame/mods.qc
6 Item_DataLink_Nex_ModSwitch
10 // first line filename
11 // second line mod name
13 void() _IDLNMS_Build =
15 local float lSearchHandle;
16 local float lSearchSize;
17 local float lSearchCounter;
19 lSearchHandle = search_begin( "*.modinfo", true, true );
20 if( lSearchHandle < 0 ) {
21 String_EntitySet( self, valueList, "'progs.dat'" );
22 String_EntitySet( self, descList, "'Deathmatch'" );
27 for( lSearchSize = search_getsize( lSearchHandle );
28 lSearchCounter < lSearchSize; ++lSearchCounter ) {
30 local string lFilename;
32 local string lModName;
33 local string lModPath;
36 lFilename = search_getfilename( lSearchHandle, lSearchCounter );
37 lHandle = fopen( lFilename, FILE_READ );
39 print( "Menu: Couldn't open modinfo file '", lFilename, "'\n" );
43 lModPath = String_Create();
44 lModName = String_Create();
46 lLine = fgets( lHandle );
47 if( !validstring( lLine ) )
50 lModPath = String_Set( lModPath, lLine );
52 lLine = fgets( lHandle );
53 if( !validstring( lLine ) )
56 lModName = String_Set( lModName, lLine );
58 String_EntitySet( self, valueList, strcat( self.valueList, lModPath, " " ) );
59 String_EntitySet( self, descList, strcat( self.descList, lModName, " " ) );
61 String_Free( lModPath );
62 String_Free( lModName );
67 search_end( lSearchHandle );
70 void() Item_DataLink_Nex_ModSwitch_Spawn =
72 local string lTemp1, lTemp2;
74 String_EntityCreate( self, valueList );
75 String_EntityCreate( self, descList );
79 lTemp1 = self.descList;
80 lTemp2 = self.valueList;
81 Item_DataLink_TextSwitch_Spawn();
82 String_Free( lTemp1 );
83 String_Free( lTemp2 );