Checking if object is in a specific area?
#4

pawn Код:
stock IsObjectInArea(objectid, Float:minx, Float:maxx, Float:miny, Float:maxy)
{
    new Float: X, Float: Y, Float: Z;
    GetObjectPos(objectid, X, Y, Z);
    new Float:valmaxx, Float:valminx = (minx > maxx) ? (maxx, valmaxx = minx) : (minx, valmaxx = maxx);
    new Float:valmaxy, Float:valminy = (miny > maxy) ? (maxy, valmaxy = miny) : (miny, valmaxy = maxy);
    //Small debug, just in case they happen to enter the wrong value.
    if(X >= valminx && X <= valmaxx && Y >= valminy && Y <= valmaxy) return 1;
    return 0;
}
Reply


Messages In This Thread
Checking if object is in a specific area? - by davve95 - 02.03.2014, 16:43
Re: Checking if object is in a specific area? - by fordawinzz - 02.03.2014, 16:45
Re: Checking if object is in a specific area? - by davve95 - 02.03.2014, 21:53
Re: Checking if object is in a specific area? - by Threshold - 03.03.2014, 06:00
Re: Checking if object is in a specific area? - by Threshold - 03.03.2014, 09:55
Re: Checking if object is in a specific area? - by davve95 - 03.03.2014, 17:48
Re: Checking if object is in a specific area? - by Threshold - 04.03.2014, 11:37
Re: Checking if object is in a specific area? - by davve95 - 04.03.2014, 15:02

Forum Jump:


Users browsing this thread: 1 Guest(s)