new Float:RandomCarSpawn[][] = { {427,2239.6694,2441.9373,3.4053,88.4534,0,1},//I know it's the same car , it's for the exemple {427,2239.6694,2441.9373,3.4053,88.4534,0,1}, {427,2239.6694,2441.9373,3.4053,88.4534,0,1} };
if (result == 0) { AddStaticVehicle(470,1678.5349,1790.9318,10.8172,268.2018,43,0); // } if (result == 1) { AddStaticVehicle(485,1669.7319,1564.0251,10.4399,181.8410,1,75); // } if (result == 2) { AddStaticVehicle(583,1274.0514,1503.6760,10.3606,179.7288,1,1); // }
enum RandomCarSpawnStruct
{
e_RandCarModel,
Float:e_RandCarPos[4],
e_RandCarCol1, //Or create it as an array.
e_RandColCol2,
}
new
RandomCarSpawns[MAX_RANDOM_VEHICLES][RandomCarSpawnStruct] =
{
{model, {positionX, positionY, positionZ, angle}, col1, col2},
{model2, {...}, col1, col2}
};
#include <a_samp>
new Float:RandomCarSpawn[][] =
{
{Float:427,2239.6694,2441.9373,3.4053,88.4534,Float:0,Float:1},
{Float:427,2239.6694,2441.9373,3.4053,88.4534,Float:0,Float:1},
{Float:427,2239.6694,2441.9373,3.4053,88.4534,Float:0,Float:1},
{Float:427,2239.6694,2441.9373,3.4053,88.4534,Float:0,Float:1},
{Float:427,2239.6694,2441.9373,3.4053,88.4534,Float:0,Float:1},
{Float:427,2239.6694,2441.9373,3.4053,88.4534,Float:0,Float:1}
//and so on
};
public OnFilterScriptInit()
{
for(new i=0,x; i<80; i++)//spawn 80 cars from the list (some be spawned multiple times ofc. its jsut an example)
{
x = random(sizeof RandomCarSpawn);
AddStaticVehicle(_:RandomCarSpawn[x][0],
RandomCarSpawn[x][1],
RandomCarSpawn[x][2],
RandomCarSpawn[x][3],
RandomCarSpawn[x][4],
_:RandomCarSpawn[x][5],
_:RandomCarSpawn[x][6]);
}
return 1;
}
AddStaticVehicle(floatround(RandomCarSpawn[0][0]), RandomCarSpawn[0][1]...
@CutX
Why would you add Float tag to every item in the array since you added the tag to the array's name? |
new RandomCarSpawn[][] = //now we have to add the tag 4 times every row
{//instead of just three and the same goes when using it
{427,_:2239.6694,_:2441.9373,_:3.4053,_:88.4534,0,1},
{427,_:2239.6694,_:2441.9373,_:3.4053,_:88.4534,0,1},
{427,_:2239.6694,_:2441.9373,_:3.4053,_:88.4534,0,1},
{427,_:2239.6694,_:2441.9373,_:3.4053,_:88.4534,0,1},
{427,_:2239.6694,_:2441.9373,_:3.4053,_:88.4534,0,1}
//and so on for 80 cars
};
public OnFilterScriptInit()
{
for(new i=0,x; i<80; i++)
{
x = random(sizeof RandomCarSpawn);// 4 times _: instead of just 3 LAZYNESS :P
AddStaticVehicle(RandomCarSpawn[x][0],
_:RandomCarSpawn[x][1],
_:RandomCarSpawn[x][2],
_:RandomCarSpawn[x][3],
_:RandomCarSpawn[x][4],
RandomCarSpawn[x][5],
RandomCarSpawn[x][6]);
}
return 1;
}