You are using linepick incorrectly:
Your first 3 parameters are correct -the position you wish to linepick from. The next 3 parameters should be the components of the vector from your starting position to your ending position. Assuming your target point is at coordinates "TargetX#, TargetY# and TargetZ#" then do this instead:
linepick entityx(gb),entityy(gb)+h,entityz(gb),targetx-entityx(gb),h+targety-entityy(gb),targetz-entityz(gb)
Your first 3 parameters are correct -the position you wish to linepick from. The next 3 parameters should be the components of the vector from your starting position to your ending position. Assuming your target point is at coordinates "TargetX#, TargetY# and TargetZ#" then do this instead:
linepick entityx(gb),entityy(gb)+h,entityz(gb),targetx-entityx(gb),h+targety-entityy(gb),targetz-entityz(gb)