Quote:
Originally Posted by Mitchell
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.
|
You might want to compare the distance as a power of 2, to avoid potentially doing (MAXPLAYERS+1)*(MAXPLAYERS+1)*10 square roots a second.
__________________