OK I have it working fine now...
Suggestions? Besides using the amxx natives to get the filename
Code:
// Assuming a max of 150 lines and each line is less than 256 characters... if not... TOO BAD
new szEachLine[150][256];
public WC3_EnableModule( module_name[] )
{
new const szModulesINI[] = "addons/amxmodx/configs/modules.ini";
new line = 0, len, iTotalLines = 0;
if ( file_exists( szModulesINI ) )
{
while ( ((line = read_file( szModulesINI, line, szEachLine[iTotalLines++], 255, len)) != 0) && iTotalLines < 150 ){}
}
// Now we have every line of modules.ini in our szEachLine variable, w00t
// Check out each line please
for ( new i = 0; i < iTotalLines; i++ )
{
// Module Name Found
if ( contain( szEachLine[i], module_name ) != -1 )
{
// Semicolon before module name found
if ( contain( szEachLine[i], ";" ) != -1 )
{
new len = strlen( szEachLine[i] ), pos = 0;
new szTemp[256];
for ( new j = 1; j < len; j++ )
{
add( szTemp, 255, szEachLine[i][j], 1 );
//pos += ( szTemp[pos], 255 - pos, "%c", szEachLine[i][j] );
}
copy( szEachLine[i], 255, szTemp );
}
}
}
unlink( "addons/amxmodx/configs/modules.ini" );
// Check out each line please
for ( new i = 0; i < iTotalLines; i++ )
{
write_file( "addons/amxmodx/configs/modules.ini", szEachLine[i] );
}
}
__________________