Detecting object on pickup/ position ( no player) - 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)
+--- Thread: Detecting object on pickup/ position ( no player) (
/showthread.php?tid=296152)
Detecting object on pickup/ position ( no player) -
ombre - 10.11.2011
Hi,
I have some pickup and if I create a object, check if the object is near ( range 10) of a pickup so...
It's like IsPlayerInRangeOfPoint, but i don't want to use the player id but the object.
ex: IsPlayerInRangeOfPoint( object, 10, pickupx[i],pickupy[i],pickupz[i]) or if objectX objectY objectZ is near(10) to pickupx[i],pickupy[i],pickupz[i] {...}
It's easy with the id player but with a position I don't made that.
Thanks for your help.
Re: Detecting object on pickup/ position ( no player) -
Norn - 10.11.2011
pawn Код:
public 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(objectid, 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;
}
Then you would do for example:
pawn Код:
if(ObjectToPoint(2.0,football,122.3518,2499.8162,16.4844))
Re : Detecting object on pickup/ position ( no player) -
ombre - 11.11.2011
thx men