Code:
player_height = c_trace(player.x, vector(player.x, player.y, player.z - 1000), IGNORE_ME | IGNORE_PASSABLE | USE_BOX);


I guess you set "player_height" to player.z? This would be wrong, because this is always the distance of the trace ray. It have to be something like this:

Code:
result = c_trace(player.x, vector(player.x, player.y, player.z - 1000), IGNORE_ME | IGNORE_PASSABLE | USE_BOX);
if(result>0){player_height=hit.z;}