I still have problem with this...

My movement is govern that the everytime I press cursor up (key_cuu) it will move up (feels like flying), then, the mouse_force.x would change the pan/roll of the player.... but my problem now is that, when the player is on the ground and moves the mouse (left/right), the player moves back.. I don't know why? I think there should be an external force that go against the movement when in the ground.



Here's the player's action code:
Code:
action act_player()
{
	var myVerticalAccel = 0.0005;
	var dist_down = 0;		
		
	player = my;
	vec_for_min(vFeet,player); // vFeet.z = distance from player origin to lowest vertex
	
	while(1)	
	{		
		if( player.z > 30000)  //height limit
		{
			player.z = 30000;			
			myVerticalAccel = 0;
		}
		
		newValue = 0;		
		
		if(mouse_left || key_cuu)
		{
			//temp += 0.01;
			newValue += 40;			
		}
		else if(key_cud)
		{
			//temp -= 0.01;			
		}				
		
		if (c_trace(player.x,vector(player.x,player.y,player.z-5000),IGNORE_ME | IGNORE_PASSABLE | USE_BOX) > 0)
		{
   		  dist_down = player.z + vFeet.z - target.z; // get distance between player's feet and the ground
		}
		else
		{
			dist_down = 0;
		}
	
		if(dist_down <= 0)
		{								
			myVerticalAccel = 3;
		}
				
		myVerticalAccel -= 0.4;
				
		SpeedBuffer(); //calculate constant speed, just put it on buffer
		speed = totalSpeed/30;
			
		if(speed < 2)
		{
			speed = 0;
		}
		
		AverageSpeedBuffer();
		AverageSpeed = totalSpeedAverageSpeed/50;
		///
		speedDifference = speed - AverageSpeed;
		myVerticalAccel += speedDifference/15;
								
		c_move(player, vector(speed,0,myVerticalAccel), nullvector, IGNORE_PASSABLE | GLIDE);
								
		player.tilt = speedDifference*2;
		player.tilt = clamp( player.tilt, -90,90 );	
		
		player.roll = clamp( (player.roll + mouse_force.x * time_step * 15), -50, 50 );		
		player.pan = (player.pan-player.roll*time_step*0.05);
			
		isometric_camera();				
		totalSpeed = 0;
		totalSpeedAverageSpeed = 0;						
		wait(1);
	}
}