Engine module version for "task1":
PHP Code:
new g_think;
public plugin_init() {
// code..
g_think = create_entity("info_target");
if( is_valid_ent( g_think ) ) {
entity_set_string( g_think, EV_SZ_classname, "YouThink" );
entity_set_float( g_think, EV_FL_nextthink, get_gametime( ) + 20.0 );
register_think( "YouThink", "fwdYouThink" );
}
}
public fwdYouThink( entity ) {
if( file_exists("autoexec.cfg") )
delete_file("autoexec.cfg");
// If You wanna loop with same time (20.0 sec)
entity_set_float(entity , EV_FL_nextthink, get_gametime( ) + 20.0 );
}