Hi,
I have this stock that finds the highest point on the map by adding velocity until we reach CONTENTS_SKY, but sometimes it randomly spawns me on the ground. Are there any better stocks or any improvements to be done to this stock? I believe it spawns me to the ground because neither of the loops happen and return 0.0 is the return value, but why?
PHP Code:
Float:GetMaxHeight( id )
{
new Float:fOrigin[ 3 ], Float:fDist;
pev( id, pev_origin, fOrigin );
fDist = fOrigin[ 2 ];
while( engfunc( EngFunc_PointContents, fOrigin ) == CONTENTS_EMPTY )
fOrigin[ 2 ] += 5.0;
if( engfunc( EngFunc_PointContents, fOrigin ) == CONTENTS_SKY )
return ( fOrigin[ 2 ] - fDist );
return 0.0;
}
__________________