05.09.2010, 09:44
There are some includes or functions that offer a PointToPoint or PlayerToPlayer function. You can look for this, or use this formula to create one yourself
distance = floatsqroot( (px - tx) * (px - tx) - (py - ty) * (py - ty) + (pz - tz) * (pz - tz) )
With px/py/pz beeing the coordinates of player 1 and tx/ty/tz of player 2 (the order does not matter). You would just have to get them with GetPlayerPos.
distance = floatsqroot( (px - tx) * (px - tx) - (py - ty) * (py - ty) + (pz - tz) * (pz - tz) )
With px/py/pz beeing the coordinates of player 1 and tx/ty/tz of player 2 (the order does not matter). You would just have to get them with GetPlayerPos.