13.04.2013, 13:31
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;
And then, I set a repeated timer(200 ms) to check IsPlayerInRangeOfPoint.
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.
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;
}
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!");
}
}
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.