Vehicle pickups
#1

I have a problem with my vehicle pickups. I know that vehicle pickup(id 14) is bugged on a custom objects/out of SA. So I'm creating it with IsPlayerInRangeOfPoint. But the problem is;

pawn Код:
enum PickupInfo
{
    Float:Range[3],
    Pickups[3]
}
new pData[100][PickupInfo];

stock CreateVehicleRepair(Float:X, Float:Y, Float:Z)
{
    for(new p = 0; p < sizeof(pData); p++)
    {  
        pData[p][Pickups][0] = CreateDynamicPickup(1239, 23, X, Y, Z);
        pData[p][Range][0] = X;// for IsPlayerInRangeOfPoint
        pData[p][Range][1] = Y;// for IsPlayerInRangeOfPoint
        pData[p][Range][2] = Z;// for IsPlayerInRangeOfPoint
printf("Range = X: %f | Y: %f | Z: %f", pData[p][Range][0], pData[p][Range][1], pData[p][Range][2]);
//Printed X, Y, Z. No problems were found.
        return 1;
    }
    return 0;
}
And then, I set a repeated timer(200 ms) to check IsPlayerInRangeOfPoint.
pawn Код:
//Under the timer callback.
for(new p = 0; p < sizeof(pData); p++)
{
if(IsPlayerInRangeOfPoint(i, 3.5, pData[p][Range][0], pData[p][Range][1], pData[p][Range][2]) && IsPlayerInAnyVehicle(i))
            {
                    RepairVehicle(VID);
                    SetVehicleHealth(VID, 1000);
                    SendClientMessage(i, -1, "Vehicle repaired!");
                }
            }
So I did this;
CreateVehicleRepair(0,0,5);
CreateVehicleRepair(0,0,10);
CreateVehicleRepair(0,0,15);
CreateVehicleRepair(0,0,20);

The pickups were there. But the problem is, only the last one(0,0,20) was working. The other pickups were not working.
Reply
#2

Factor in lag, and speed when your driving 3.5 meter range on a 200ms will only be sporadically called. 100km/h is 27 meters per second divide by 5 which is 5.4 meters per 200ms. Also consider your timer times are inaccurate so about 894ms is about 1 second approximately you need to set your timer to 178ms for 200ms.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)