Modified script to check before I use handle(), now I dont get errors but it just seems to not do anything now... Mabe it gets caught in an infinite loop?

Code:
#include <acknex.h>
#include <default.c>
#include <mtlFX.c>

//TEST CARS
ENTITY* TEST_Car;
ENTITY* TEST_CarInFront;
//TEST CARS


void LoadCarVariables(var MyCar, var OtherCar, int Speed)
{
	ENTITY* TargetCar; //CAR I WANT TO LOAD VARIABLES INTO
	TargetCar=ptr_for_handle(MyCar); //LOAD POINTER TO CREATED CAR


	TargetCar.skill1 = OtherCar; //Load handle to car in front, if there was no car in front I should have recieved a 0
	TargetCar.skill2 = Speed; //Just an example of passing another variable to the new car we just created
	TargetCar.skill6=1; //To tell the car it has it's variables loaded and ready
}

action CarAction()
{
	my.skill6=0;//Make sure skill6 is "0", to indicate my variables are not loaded yet
	ENTITY* InFrontOfMe; //A POINTER TO THE CAR THAT IS IN FRONT OF THIS ONE
	int MyCarFits = 0; //variable for waiting till the new car fits behind the car in front
	wait(1);
	while(1)
	{
		if(my.skill6==1) //ONLY DO STUFF IN MY WHILE LOOP IF VARIABLES HAVE BEEN LOADED
		{
			if(MyCarFits==0) //IF MY CAR DOES NOT FIT CHECK IF IT DOES
			{
				
				if (my.skill1!=0) //if there was no car in front I should have recieved "0" so I load pointer as NULL, if there was then load the handle into my InFrontOfMe pointer
				{
					InFrontOfMe = ptr_for_handle(my.skill1); //Load handle of car in front into pointer
					if(abs((vec_dist(vector(my.x,my.y,0),vector(InFrontOfMe.x,InFrontOfMe.y,0)))) > (abs(InFrontOfMe.min_x)+(abs(my.max_x))))//si el de delante se ha alejado suficiente
					{
						MyCarFits=1;
					}
				}
				else //IF THERE IS NO CAR IN FRONT (I am the first car created) THEN ASSUME THAT I MUST BE ABLE TO FIT
				{
					MyCarFits=1;
				}
			}
			else //IF MY CAR ALREADY FITS THEN START MOVING (the variable loaded into skill2 controls the speed)
			{
				c_move(me,vector(my.skill2 * time_step,0,0),nullvector,IGNORE_PASSABLE);
				//DELETED ALL IRRELEVANT CAR CODE AND JUST LEFT MOVEMENT FOR TESTING PURPOSES
			}
		}
		
	}
	wait(1);
}


void main()
{
	
	//BASIC LOAD INSTRUCTIONS ONLY FOR TEST
	video_switch(8,0,0);
	level_load("Ciudad.wmb");
	
	//BASIC CAMERA FOR TESTING WITH A GOOD TOP VIEW OF THE STREET
	vec_set(camera.x,vector(-1043.581,-40.077,752));
	vec_set(camera.pan,vector(-4.269,-35.397,0));
	//wait(1);


	TEST_CarInFront=NULL; //FORCE TEST WHEN THERE IS NO CAR IN FRONT... If this is the first car created the car in front pointer will be null
	TEST_Car=ent_create("JESUS.mdl",vector(0,0,32),CarAction); //Create first car
	if(TEST_CarInFront) //if it is not null pass the handle, if it is null pass 0
	{
		LoadCarVariables(handle(TEST_Car),handle(TEST_CarInFront), 3); //Load first car's variables with handle to car in front
	}
	else
	{
		LoadCarVariables(handle(TEST_Car),0, 3); //Load first car's variables with no car in front "0"
	}

	while(1)
	{
		//DELETED ALL IRRELEVANT LEVEL CODE TO ONLY TEST WHAT IS PROVOKING THE ERROR
		wait(1);
	}
}



EDIT:
Ok, I added breakpoints all over the place and it seems to get caught in the CarAction while loop forever as if skill6 was never==1 and it never returns to the main function to call the LoadCarVariables() function
Anyone know why?


"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1