Is there a GetDistanceFromPlayerToPoint function?
#2

pawn Код:
/* credits to the original author (i don't know who created this function) */
stock Float:GetPlayerDistanceToPoint(playerid, {Float,_}:...)
{
  new
      num = numargs(), Float:pos[3];
  GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  if(num == 3) return floatsqroot(floatpower(floatabs(floatsub(pos[0], Float:getarg(1))), 2) + floatpower(floatabs(floatsub(pos[1], Float:getarg(2))), 2));
  else if(num == 4) return floatsqroot(floatpower(floatabs(floatsub(pos[0], Float:getarg(1))), 2) + floatpower(floatabs(floatsub(pos[1], Float:getarg(2))), 2) + floatpower(floatabs(floatsub(pos[2], Float:getarg(3))), 2));
  return -1.0;
}
Reply


Messages In This Thread
Is there a GetDistanceFromPlayerToPoint function? - by Celson - 15.01.2010, 13:50
Re: Is there a GetDistanceFromPlayerToPoint function? - by Correlli - 15.01.2010, 13:53
Re: Is there a GetDistanceFromPlayerToPoint function? - by Celson - 15.01.2010, 14:01

Forum Jump:


Users browsing this thread: 2 Guest(s)