Try this:
Code:
#include <amxmodx>
#include <amxmisc>
#define VERSION "1.0"
new g_szFile[ 62 ];
public plugin_precache()
{
get_configsdir( g_szFile, 61 );
new mapname[ 20 ];
get_mapname( mapname, 19 );
format( g_szFile, 61, "%s/test/%s.ini", g_szFile, mapname );
fclose( fopen( g_szFile, "x" ) ); // Creates the file. // I think it's useless as the file is
// created when attempting to write into it.
}
public plugin_init()
{
register_plugin( "File Test", VERSION, "Dores" );
register_clcmd( "say /lol", "Cmd_LoL" );
}
public Cmd_LoL( id )
{
new f = fopen( g_szFile, "w" );
fputs( f, "LoL" );
fclose( f ); // Always close the file no matter what.
}
Type in chat: /lol, or say /lol in console to write "LoL" into the file.
__________________