Detecting if palyer is in range of multiple objects
#1

When I try to detect range of several objects can not I do not know why ... Every time says that I am to far from the object, and when I stand beside object... Can someone help me ...?
Thanks in advance ...
ps. Sorry for bad english...
pawn Код:
new Object[6];
   
    Object[0] = CreateObject(19076, 536.09997558594, -2232.8999023438, 4.6999998092651, 0, 0, 0,900.0);
    Object[1] = CreateObject(694, -2122.1000976563, -1448.5999755859, 201.69999694824, 0, 0, 236.08520507813,900.0);
    Object[2] = CreateObject(3830, 467.70001220703, -2207.6000976563, 9.1000003814697, 0, 0, 218,900.0);
    Object[3] = CreateObject(3886, 524.3994140625, -2159.69921875, -0.10000000149012, 0, 0, 309.99572753906,900.0);
    Object[4] = CreateObject(3886, 527.3994140625, -2157.099609375, -0.10999999940395, 0, 0, 309.99572753906,900.0);
    Object[5] = CreateObject(3599, 490, -2223.2998046875, 7.0999999046326, 0, 0, 151.99584960938,900.0);
   
    if (strcmp("/test", cmdtext, true, 10) == 0)
    {
        for(new i = 0;i<5;i++)
        {
            GetObjectPos(Object[i], ox, oy, oz);
            if(IsPlayerInRangeOfPoint(playerid, 5, ox, oy, oz))
            {
                SendClientMessage(playerid, -1, "You are close to the object.");
                return 1;
            }
            else
            {
                SendClientMessage(playerid, -1, "You are to far from the object.");
                return 1;
            }
        }
        return 1;
    }
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)