Thread
:
Detect Player is near to another player
View Single Post
Mitchell
~lick~
Join Date: Mar 2010
02-14-2017 , 17:02 Re: Detect Player is near to another player
#
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
View Public Profile
Send a private message to Mitchell
Visit Mitchell's homepage!
Find More Posts by Mitchell