pawn Код:
#define INF_INT 0x7F800000
const Float:INF_FLOAT=Float:0x7F800000;
stock Float:GetPlayerDistanceToPointXY(playerid,Float:xs,Float:ys)
{
return GetDistanceToPointXY(playerid,xs,ys);
}
stock Float:GetDistanceToPointXY(playerid,Float:xs,Float:ys)
{
new Float:x1,Float:y1,Float:z1;
GetPlayerPos(playerid,x1,y1,z1);
return GetDistanceToPoint(playerid,xs,ys,z1);
}
stock Float:GetDistanceBetweenPoints(Float:x1,Float:y1,Float:z1,Float:x2,Float:y2,Float:z2)
{
return floatadd(floatadd(floatsqroot(floatpower(floatsub(x1,x2),2)),floatsqroot(floatpower(floatsub(y1,y2),2))),floatsqroot(floatpower(floatsub(z1,z2),2)));
}
stock Float:GetDistanceToPoint(playerid,Float:x1,Float:y1,Float:z1)
{
if (IsPlayerConnected(playerid))
{
new Float:x2,Float:y2,Float:z2;
GetPlayerPos(playerid,x2,y2,z2);
return GetDistanceBetweenPoints(x1,y1,z1,x2,y2,z2);
}
return INF_FLOAT;
}