AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Comparing players origin (https://forums.alliedmods.net/showthread.php?t=170171)

Mlk27 10-21-2011 11:21

Comparing players origin
 
My scripting skill has been rusty due to not doing any scripting for a long time now. How do you save the 'before' and 'after' origins (X,Y,Z) of all players and then compare them together to see if they are the same?

Bugsy 10-21-2011 11:53

Re: Comparing players origin
 
Not sure if I understood correctly but you can get both origins and then check the distance apart which will determine if there was a change. To check all just use a loop with get_players().
PHP Code:

new Float:fOriginBefore33 ][ ];
new 
Float:fOriginAfter33 ][ ];

pevid pev_origin fOriginBeforeid ] );
//Same for after origin

new Float:fDistanceApart get_distance_ffOriginBefore fOriginAfter ); 


Mlk27 10-21-2011 15:39

Re: Comparing players origin
 
You understood my question correctly :)

that fDistanceApart var, the distance is calculated for which angle?

Bugsy 10-21-2011 15:57

Re: Comparing players origin
 
Total distance, each axis is considered. If, for example you want only ground distance, set Z coord (origin[ 2 ]) on both origins to 0.


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

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