Raised This Month: $ Target: $400
 0% 

Get distance from ground


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
hornet
AMX Mod X Plugin Approver
Join Date: Mar 2010
Location: Australia
Old 05-09-2013 , 09:29   Re: Get distance from ground
Reply With Quote #6

Quote:
Originally Posted by jimaway View Post
unfortunately that will fail when the player is on/over an edge of a higher point
Good thinking.

To fix Connor's:
Code:
Float:distance_to_ground( id ) {     new Float:start[3], Float:end[3], bool:bDucking;     entity_get_vector(id, EV_VEC_origin, start);     bDucking = !!(entity_get_int(id, EV_INT_flags) & FL_DUCKING);     if( bDucking )     {         start[2] += 18.0;     }         end[0] = start[0];     end[1] = start[1];     end[2] = start[2] - 9999.0;         new ptr = create_tr2();     engfunc(EngFunc_TraceHull, start, end, IGNORE_MONSTERS, HULL_HUMAN, id, ptr);     new Float:distance;     get_tr2(ptr, TR_flFraction, distance);     free_tr2(ptr);     distance *= 9999.0;             return distance; }
__________________
Quote:
vBulletin Tip #42: Not much would be accomplished by merging this item with itself.

Last edited by hornet; 05-09-2013 at 09:31.
hornet is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:55.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode