Detecting object on pickup/ position ( no player)
#1

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.
Reply
#2

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))
Reply
#3

thx men
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)