SA-MP Forums [SOLVED] Point in range of point.
 User Name Remember Me? Password
 New Account Members List Search Today's Posts Mark Forums Read

 Thread Tools Display Modes
 31/01/2010, 07:55 PM #1 CaHbKo Huge Clucker   Join Date: Nov 2007 Posts: 399 Reputation: 41 [SOLVED] Point in range of point. 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. __________________
31/01/2010, 09:28 PM   #2
bartje01
High-roller

Join Date: Jan 2009
Posts: 1,419
Reputation: 6
Re: [HELP] Point in range of point.

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;
}

 31/01/2010, 09:56 PM #3 Backwardsman97 High-roller     Join Date: Nov 2007 Posts: 1,501 Reputation: 36 Re: [HELP] Point in range of point. 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);}` __________________
01/02/2010, 01:04 PM   #4
CaHbKo
Huge Clucker

Join Date: Nov 2007
Posts: 399
Reputation: 41
Re: [HELP] Point in range of point.

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.
__________________

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post XRVX Help Archive 2 17/04/2010 02:22 AM JoeDaDude Help Archive 2 31/12/2009 02:08 PM osanji Help Archive 3 31/12/2009 01:10 PM DeltaAirlines12 Help Archive 2 27/09/2009 04:59 PM

All times are GMT. The time now is 02:11 AM.

 -- (EN) English -- (RU) Русски SA-MP - Archive - Top