new array[2] = { 1, 2 };
new cars[2] = { CreateVehicle(0, 0, 0, 0, 0, -1, -1, 200), CreateVehicle(0, 0, 0, 0, 0, -1, -1, 200) };
CreateSpecialVehicle(Something)
{
switch (Something)
{
case 1: return CreateVehicle(562, 0, 0, 0, 0, -1, -1, 200);
case 2: return CreateVehicle(412, 0, 0, 0, 0, -1, -1, 200);
case 3: return CreateVehicle(592, 0, 0, 0, 0, -1, -1, 200);
case 4: return CreateVehicle(517, 0, 0, 0, 0, -1, -1, 200);
}
return 0;
}
for(i=0; i<=sizeof(cars); i++)
cars[0] = ... cars[1] = ... cars[2] = ... cars[3] = ... ...
cars[size] = { car, car, car ... }
You have an array of model-id's and coordinates, and you want to create those vehicles with a loop?
|
enum TDefinedCars
{
Model,
Float:SpawnX,
Float:SpawnY,
Float:SpawnZ
}
new DefinedCars[20][TDefinedCars] =
{
{562, 100.0, 100.0, 5.0},
{418, 150.0, 258.1, 7.8},
...
{519, -130.5, 179.8, 11.4}
}
new Cars[20];
for (new i; i < 20: i++)
Cars[i] = CreateVehicle(DefinedCars[i][Model], DefinedCars[i][SpawnX], DefinedCars[i][SpawnY], DefinedCars[i][SpawnZ], 0.0, 0, 0, 60);