IsObjectInRangeOfPoint[SOLVED] - 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: IsObjectInRangeOfPoint[SOLVED] (
/showthread.php?tid=149225)
IsObjectInRangeOfPoint[SOLVED] -
Retardedwolf - 21.05.2010
Is there any functions like IsObjectInRangeOfPoint or can someone tell me which is the best and efficient way to find the closest object to x,y,z and a example thanks.
I'm just trying to get a object closest to position and how you can do it.
Re: IsObjectInRangeOfPoint -
[HiC]TheKiller - 21.05.2010
For the first ones, find PlayerToPoint and edit it then do a loop through all the objects and use GetDistanceBetweenPoints or whatever it is named.
Re: IsObjectInRangeOfPoint -
misko28 - 21.05.2010
Код:
stock ObjectToPoint(Float:radi, objectid, Float:x, Float:y, Float:z)
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetObjectPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
return 0;
}
Re: IsObjectInRangeOfPoint -
Retardedwolf - 21.05.2010
Quote:
Originally Posted by misko28
Код:
stock ObjectToPoint(Float:radi, objectid, Float:x, Float:y, Float:z)
{
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetObjectPos(playerid, oldposx, oldposy, oldposz);
tempposx = (oldposx -x);
tempposy = (oldposy -y);
tempposz = (oldposz -z);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
return 0;
}
|
Thank you.
If I can help you with anything I'll do it except for anything else than money.