this my changed code for gravity

Code:
function gravity_ent(ENTITY* ent)
{

	result10 = c_trace(ent.x,vector(ent.x,ent.y,ent.z - 4000),IGNORE_ME|IGNORE_PASSABLE|USE_BOX);
	if(ent == player)
	{
		if(active_gravity == 1)
		{
			if(jump == 0)
			{
				ent.z_dist = result - 3;
				if (ent.z_dist > 1)
				{
					ent.force_z -= 3 * time_step;
					ent.force_z = maxv(-30,ent.force_z);
				}
				ent.velocity_z += (time_step * ent.force_z) - (minv(time_step*0.7,1) * ent.velocity_z);
				ent.move_z = ent.velocity_z * time_step;
				if (ent.z_dist < 0) { ent.move_z = clamp(-ent.z_dist,-5,0.1); ent.velocity_z = 0; ent.force_z = 0; }
				c_move (ent,vector(0,0,ent.move_z),nullvector,IGNORE_PASSABLE | GLIDE);
			}
		}
	}
}