this is the jumping code i'm using. i took it from AUM but maybe it needs to be fixed cause when i jumo on a block or model the player doesnt go downwards and it jumps again. its like when the player is in the air and reaches and obstacle beneath him the height sets to zero making it to jump again.

my code:

vec_set(temp.x, my.x);
temp.z -= 10000;
floor = c_trace(my.x, temp.x, IGNORE_ME | IGNORE_PASSABLE | USE_BOX | GLIDE); // compute the distance between player's origin and the floor below its feet


if(joy_4 && floor < 30 && jump == 0 && J == 0)
{
jump = 1;
}
if(jump == 1)
{

c_move(me,vector(0, 0, 20*time_step), nullvector, GLIDE);
J = 1;
}
if(floor > 30)
{
jump = 2;
}
if(floor < 1 && !joy_4)
{
jump = 0;
J = 0;
}

c_move(me, nullvector, vector(0, 0, -1), GLIDE);