Why not just work out the height of the collision?
You know the angle of fire, the start height and the distance (or can work them out), so you can just use that to work out the collision height ... if it's above a certain height, it must be a headshot.
For example, if your gun height is 10, the angle of fire is 2 degrees upwards, and the distance is 50, then the following line will give you the height of the collision.
print newyvalue(10.0, -2.0, 50.0)
wait key
Use negative numbers for upward angles, positive numbers for downward angles.