20.07.2014, 16:52
I tried setting up a random vehicle spawn system so that every time it spawns, it chooses a random location each time. When I tested it, every vehicle just tried to spawn in the same location.
pawn Код:
//Random Spawn Float
new Float: RandomVehicleSpawns[][] =
{
{490.8827, 868.8945, -31.6403, 228.5856},
{492.0695, 898.3134, -31.4417, 340.1074},
{868.7068, 924.2509, 13.1898, 2.7240},
{577.1639, 1076.7039, 28.1347, 88.3344},
{586.0138, 1224.3378, 11.5540, 1.1765},
{160.0283, 1186.5177, 14.8515, 37.8921},
{-82.0563, 1340.0801, 10.7452, 7.0630},
{-302.4243, 1750.6183, 42.5254, 156.3794},
{-366.1618, 2244.6304, 42.2960, 14.4192},
{-711.0560, 2349.3142, 126.8845, 183.0471},
{-496.3653, 2590.5107, 53.3487, 314.6674},
{-855.6710, 2756.6531, 45.6891, 5.4393},
{-1307.6619, 2710.5342, 49.9003, 3.6414},
{86.8474, 2685.2341, 52.4419, 3.3280},
{656.5557, 2281.5239, 26.0612, 184.8369},
{691.3392, 1946.7954, 5.3781, 358.0526},
{372.9126, 1520.8871, 11.5116, 162.6114}
};
//Stock that holds every vehicle
stock LoadVehicles()
{
new vrs = random(sizeof(RandomVehicleSpawns));
CreateVehicle(411, RandomVehicleSpawns[vrs][0], RandomVehicleSpawns[vrs][1], RandomVehicleSpawns[vrs][2], 228.5856, 0, 0, 7200); //Test Veh. 1
CreateVehicle(412, RandomVehicleSpawns[vrs][0], RandomVehicleSpawns[vrs][1], RandomVehicleSpawns[vrs][2], 340.1074, 0, 0, 7200); //Test Veh. 2
CreateVehicle(463,RandomVehicleSpawns[vrs][0], RandomVehicleSpawns[vrs][1], RandomVehicleSpawns[vrs][2],2.7240,0,0,7200); // Vehicle 1/
CreateVehicle(514,RandomVehicleSpawns[vrs][0], RandomVehicleSpawns[vrs][1], RandomVehicleSpawns[vrs][2],88.3344,0,0,7200); // Vehicle 2/
CreateVehicle(568,RandomVehicleSpawns[vrs][0], RandomVehicleSpawns[vrs][1], RandomVehicleSpawns[vrs][2],1.1765,0,0,7200); // Vehicle 3/
CreateVehicle(463,RandomVehicleSpawns[vrs][0], RandomVehicleSpawns[vrs][1], RandomVehicleSpawns[vrs][2],37.8921,0,0,7200); // Vehicle 4/
CreateVehicle(433,RandomVehicleSpawns[vrs][0], RandomVehicleSpawns[vrs][1], RandomVehicleSpawns[vrs][2],7.0630,0,0,7200); // Vehicle 5/
CreateVehicle(463,RandomVehicleSpawns[vrs][0], RandomVehicleSpawns[vrs][1], RandomVehicleSpawns[vrs][2],156.3794,0,0,7200); // Vehicle 6/
CreateVehicle(568,RandomVehicleSpawns[vrs][0], RandomVehicleSpawns[vrs][1], RandomVehicleSpawns[vrs][2],14.4192,0,0,7200); // Vehicle 7/
CreateVehicle(514,RandomVehicleSpawns[vrs][0], RandomVehicleSpawns[vrs][1], RandomVehicleSpawns[vrs][2],183.0471,0,0,7200); // Vehicle 8/
CreateVehicle(568,RandomVehicleSpawns[vrs][0], RandomVehicleSpawns[vrs][1], RandomVehicleSpawns[vrs][2],314.6674,0,0,7200); // Vehicle 9/
CreateVehicle(463,RandomVehicleSpawns[vrs][0], RandomVehicleSpawns[vrs][1], RandomVehicleSpawns[vrs][2],5.4393,0,0,7200); // Vehicle 10/
CreateVehicle(433,RandomVehicleSpawns[vrs][0], RandomVehicleSpawns[vrs][1], RandomVehicleSpawns[vrs][2],3.6414,0,0,7200); // Vehicle 11/
CreateVehicle(463,RandomVehicleSpawns[vrs][0], RandomVehicleSpawns[vrs][1], RandomVehicleSpawns[vrs][2],3.3280,0,0,7200); // Vehicle 12/
CreateVehicle(568,RandomVehicleSpawns[vrs][0], RandomVehicleSpawns[vrs][1], RandomVehicleSpawns[vrs][2],184.8369,0,0,7200); // Vehicle 13/
CreateVehicle(514,RandomVehicleSpawns[vrs][0], RandomVehicleSpawns[vrs][1], RandomVehicleSpawns[vrs][2],358.0526,0,0,7200); // Vehicle 14/
CreateVehicle(568,RandomVehicleSpawns[vrs][0], RandomVehicleSpawns[vrs][1], RandomVehicleSpawns[vrs][2],162.6114,0,0,7200); // Vehicle 15
return 1;
} //Stock is executed in OnGameModeInit