Code:
public MODULE_Enable( module_name[] )
{
new fp = fopen( "addons/amxmodx/configs/modules.ini", "r+t" );
new data[128];
while( !feof( fp ) )
{
fgets( fp, data, 63 );
server_print( "Searching %s", data );
// Module Name Found
if ( contain( data, module_name ) != -1 )
{
// Semicolon before module name found
if ( contain( data, ";" ) != -1 )
{
// Lets go to the start of the line we're on so we can remove the ;
fseek( fp, strlen(data), SEEK_CUR );
// Remove the ; from the line
replace( data, strlen(data), ";" , "" );
server_print( "%s", data );
new len = strlen( data );
for ( new i = 0; i < len; i++ )
{
fputc( fp, data[i] );
server_print( "%c:%s", data[i], data[i] );
}
server_print( "done" );
}
}
}
fclose( fp );
}
I'm trying to JUST remove the semicolon at the start of the line when the appropriate module is found...
How can I achieve this? It's not actually working :/ It gets in an infinite loop and prints and prints the same crap in the file for like an eternity...
Thanks,
Josh
__________________