26.06.2011, 05:56
You could use GetDistanceBetweenPlayers
Then do this:
pawn Код:
stock Float:GetDistanceBetweenPlayers(player1, player2)
{
new Float:X, Float:Y, Float:Z, Float:PointX, Float:PointY, Float:PointZ;
GetPlayerPos(player1, X, Y, Z);
GetPlayerPos(player2, PointX, PointY, PointZ);
return floatsqroot(floatpower(floatsub(X, PointX), 2.0) + floatpower(floatsub(Y, PointY), 2.0) + floatpower(floatsub(Z, PointZ), 2.0));
}
pawn Код:
if(GetDistanceBetweenPlayers(player1, player2) <= /*Range*/)
{
//Player is in range
}