This was copied and pasted from the movement code in my own project which doesn't have the problem you complained of. You'll have to change the variable names to yours of course. I tried to delete the parts of my code that aren't directly relevant to the walking but I may have accidentally left some of it in there. If you spot any bits of code that are useless to you, ignore them.
Code:
#define speed skill2
#define animation skill3

VECTOR feet;
var distancedown;
var spin;
var mygravity = 0;

if(c_trace(my.x, vector(my.x,my.y,my.z-10000), IGNORE_ME|IGNORE_PASSENTS |USE_BOX) > 0)
	   	distancedown = my.z + feet.z - target.z;
	   	else
	   	distancedown = 0;
	   	
	   	if(distancedown > 0)
	   	distancedown = clamp(distancedown, 0, accelerate(mygravity, 9.8, 0.1)); //0.1 is friction, accelerate "mygravity" by 9.8
	   	//clamp limits distance down to lower limit 0 and upper limit accelerate(mygravity, 9.8, 0.1)
	   	else
	   	{mygravity = 0;}
	   	
	   	spin = (key_a - key_d);
	   	if((!key_a) && (!key_d))
	   	//spin = (joy_rot.x/10);
	   	spin = -(joy_force.x/4);
	      my.pan += spin * my.speed/2 * time_step;
	      
	      
	      distance = my.speed * (key_w - key_s) * time_step;
	      if ((!key_w) && (!key_s))
	      distance = my.speed * (joy_force.y) * time_step;
	      //distance = my.speed * (joy_rot.y/10) * time_step;
	      distance = sign(distance)*(abs(distance) + 0.5*distancedown); //adapt the speed on slopes
	      //sign(var X) returns -1 if X <0, 1 if X > 0, and o if X = 0
	      
	      
	   	c_move(me, vector(distance, 0, 0), vector(0, 0, -distancedown), GLIDE | USE_POLYGON |IGNORE_PASSABLE);
	   	my.animation += (distance + spin)/2;
	   	ent_animate(me, "run", my.animation, ANM_CYCLE);
	   	if(distance == 0 && spin == 0) //player didn't move
	   	{
	   		my.animation += 5*time_step;
	   		ent_animate(me, "stand", my.animation, ANM_CYCLE);
}

PUT THESE IN THE PLAYER ACTION BEFORE CALLING THE MOVEMENT FUNCTION
vec_for_min(feet, me); //assigning the lowest position of the model to the vector named "feet"
	if((my.eflags&FAT) && (my.eflags&NARROW)) //if both the fat and narrow flags are set
	my.z *= 0.5;