View Single Post
Mitchell
~lick~
Join Date: Mar 2010
Old 02-14-2017 , 17:02   Re: Detect Player is near to another player
Reply With Quote #2

You could do a multidimensional array:
bool plyNearAnother[MAXPLAYERS+1][MAXPLAYERS+1];
Then OnPlayerRunCmd store the m_vecOrigin of the client
then loop through the rest of the clients and compare the positions together using GetVectorDistance to get their distance.
If plyNearAnother[client][other] == true && distance > MaxDistance: // Player left the distance of the other.
If plyNearAnother[client][other] == false && distance <= MaxDistance: // Player is now close to the other player.
Mitchell is offline