31.07.2013, 14:58
try that, didnt test but it should work. calculating distances is a big deal. Only do if you really have to and there's no other way 'round it.
you could use it like
Код:
stock Float:GetDistance(Float:x1,Float:y1,Float:z1, Float:x2,Float:y2,Float:z2)
{
return floatsqroot(floatpower(floatabs(floatsub(x2,x1)),2)+floatpower(floatabs(floatsub(y2,y1)),2)+floatpower(floatabs(floatsub(z2,z1)),2));
}
Код:
new s[13]; format(s, sizeof s,"Distance: %f",GetDistance(945.544,489.54,45.164,2015.554,1103.10.98,45.2)); SendClientMessage(playerid,-1,s);

