[SOLVED] Point in range of point. - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [SOLVED] Point in range of point. (
/showthread.php?tid=124798)
[SOLVED] Point in range of point. -
CaHbKo - 31.01.2010
Hi,
I need a function that would check if an X.Y.Z point if in specified radius of other X.Y.Z point.
Something like IsPointInRangeOfPoint(x1, y1, z1, x2, y2, z2, radius); .
Thanks.
Re: [HELP] Point in range of point. -
bartje01 - 31.01.2010
Quote:
Originally Posted by CaHbKo
Hi,
I need a function that would check if an X.Y.Z point if in specified radius of other X.Y.Z point.
Something like IsPointInRangeOfPoint(x1, y1, z1, x2, y2, z2, radius); .
Thanks.
|
Maybe this is what you are searching for?
public OnPlayerUpdate(playerid)
{
if(IsPlayerInRangeOfPoint(playerid, 7.0, 1524.4850,-1677.8721,6.218

)
{
SendClientMessage(playerid,0xFFFFFFFF,"Yeey IceCream!!");
}
return 1;
}
Re: [HELP] Point in range of point. -
Backwardsman97 - 31.01.2010
That wouldn't help him at all. I modified ******'s version of IsPlayerToPoint.
pawn Code:
stock IsPointInRangeOfPoint(Float:x, Float:y, Float:z, Float:x2, Float:y2, Float:z2, Float:range)
{
x2 -= x;
y2 -= y;
z2 -= z;
return ((x2 * x2) + (y2 * y2) + (z2 * z2)) < (range * range);
}
Re: [HELP] Point in range of point. -
CaHbKo - 01.02.2010
Quote:
Originally Posted by Backwardsman97
That wouldn't help him at all. I modified ******'s version of IsPlayerToPoint.
pawn Code:
stock IsPointInRangeOfPoint(Float:x, Float:y, Float:z, Float:x2, Float:y2, Float:z2, Float:range) { x2 -= x; y2 -= y; z2 -= z; return ((x2 * x2) + (y2 * y2) + (z2 * z2)) < (range * range); }
|
Thank you very much.
Solved.