AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Distance when ducking! There is a problem. (https://forums.alliedmods.net/showthread.php?t=159896)

byetovice 06-23-2011 06:27

Distance when ducking! There is a problem.
 
Hello.
I'm trying to get distance between two players. But if one of players ducks, the distance gets bigger. (without ducking = 100-150 with ducking = 1500-2000)

Why ? Please help me

Hunter-Digital 06-23-2011 08:13

Re: Distance when ducking! There is a problem.
 
How did you manage that O.o show the code.

Still, simpliest way to check distance between two entities (players are entities too) is
Code:

if(entity_range(ent1, ent2) <= 100.0)
{
    // ent1 and ent2 are 100.0 units or closer
}


Exolent[jNr] 06-23-2011 08:53

Re: Distance when ducking! There is a problem.
 
Code:
new Float:vecOrigin1[ 3 ], Float:vecOrigin2[ 3 ]; entity_get_vector( iPlayer1, EV_VEC_origin, vecOrigin1 ); entity_get_vector( iPlayer2, EV_VEC_origin, vecOrigin2 ); if( get_entity_flags( iPlayer1 ) & FL_DUCKING ) {     vecOrigin1[ 2 ] += 18.0; } if( get_entity_flags( iPlayer2 ) & FL_DUCKING ) {     vecOrigin2[ 2 ] += 18.0; } new Float:flDistance = get_distance_f( vecOrigin1, vecOrigin2 );


All times are GMT -4. The time now is 23:32.

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