30.10.2011, 08:35
1 unit ingame = 1 meter, considering that when you import a skin into 3D's max its height is 1.85 units. If your friend is really across half the map (SA map is 6000x6000), then that's correct. Otherwise, try this function:
pawn Код:
stock Float:GetDistanceBetweenPlayers(p1, p2)
{
new
Float:x1,
Float:y1,
Float:z1,
Float:x2,
Float:y2,
Float:z2;
if(!GetPlayerPos(p1,x1,y1,z1) || !GetPlayerPos(p2,x2,y2,z2)) return FLOAT_NAN;
return GetDistanceBetweenPoints(x1, y1, z1, x2, y2, z2);
}
stock Float:GetDistanceBetweenPoints(Float:x1, Float:y1, Float:z1, Float:x2, Float:y2, Float:z2)
{
// By ******
x1 -= x2;
y1 -= y2;
z1 -= z2;
return floatsqroot((x1 * x1) + (y1 * y1) + (z1 * z1));
}
stock IsNaN(Float:number)
{
return (number != number);
}