30.08.2014, 21:38
I got this code:
Somehow it only prints vehicle 1's data, vehicle 2's data does not print.
It's weird because when i get in vehicle 2 it identifies it correctly.
Please help.
EDIT: I fixed it by increasing the size of
by one more than the vehicles I created.
pawn Код:
//On top of script
new Iterator:Vehicle<2>;
//Both in OnGameModeInit
stock CreateVehicles()
{
Iter_Add(Vehicle, AddStaticVehicle(541,164.6181,-54.6665,1.2031,269.3175,58,8)); //veh1
Iter_Add(Vehicle, AddStaticVehicle(411,165.2549,-44.5700,1.3052,270.9745,64,1)); //veh2
return 1;
}
stock AssignVehicleFuel()
{
foreach (new vid : Vehicle)
{
new rand = randomEx(25,100);
VInfo[vid][vFuel] = rand;
printf("Vehicle ID: %d | Fuel: %d",vid, VInfo[vid][vFuel]);
}
return 1;
}
//After code
stock randomEx(min, max)
{
new rand = random(max-min)+min;
return rand;
}
It's weird because when i get in vehicle 2 it identifies it correctly.
Please help.
EDIT: I fixed it by increasing the size of
Quote:
new Iterator:Vehicle<2>; |