i have problem to run physic engine again after using physX_destroy, for what i'm not even sure that's possible
Code:
#include <default.c>
#include <ackphysX.h>
#include <mtlFX.c>

ENTITY *pole;
ENTITY *flag_ent;

action flag(){
	flag_ent = me;
	while(!pole){wait(1);}
	my.material = mtl_twosided_alpha;
	// attach flag to pole
	c_setminmax(pole);
	c_setminmax(my);
	vec_set(my.x,vector(pole.x, pole.y+(my.max_y-my.min_y)/2, pole.z+pole.max_z-(my.max_z-my.min_z)/2));
	// setup flag cloth	
	var cloth_options[40];
	memcpy(cloth_options,CLOTH_DEFAULT,40*sizeof(var));
	vec_set(cloth_options[25],vector(-10,20,0));  // external acceleration
	vec_set(cloth_options[28],vector(5,10,5));  // random wind acceleration
	cloth_options[9] = 4; // Tear Factor
	cloth_options[37] |= NX_CLF_GRAVITY|NX_CLF_BENDING|NX_CLF_COLLISION_TWOWAY|NX_CLF_SELFCOLLISION|NX_CLF_TEARABLE|NX_CLF_BENDING_ORTHO;
	pXent_cloth(my,pole,NX_CLOTH_ATTACHMENT_TWOWAY,0,0,cloth_options);
}

action flag_pole(){
	pole = me;
	vec_set(pole.scale_x,vector(0.2,0.2,40));
	vec_set(pole.pan,vector(0,0,0));
	vec_set(pole.blue,COLOR_GREY);
	pXent_settype(pole,PH_STATIC,PH_BOX);
}

void create_flag(){
	ent_create(CUBE_MDL,vector(0,0,0),flag_pole);
	ent_create("clothflag.mdl",NULL,flag);
}

void destroy_physic(){
	ent_remove(pole);
	ent_remove(flag_ent);
	physX_destroy();
}

function main(){	
	fps_max = 60;
	physX_open();
	level_load("");
	vec_set(sky_color,COLOR_BLUE);
	vec_set(sun_angle.pan,vector(300,60,5000));
	vec_set(camera.x,vector(-1200,100,500));
	vec_set(camera.pan,vector(0,-10,0));
	while(1){
		on_d = destroy_physic;
		on_o = physX_open;
		on_c = create_flag;
		wait(1);	
	}
}


how to test this code? put this script in a8 samples folder, run and press key c to create physic object. then on key d delate objects and close physic engine. after that try run physic engine on key o
what i make wrong? did anybody know how destroy and open physic engine again?