10.05.2015, 02:57
I'm trying to set up a system where when items respawn, they get spawned at random locations. However, when they spawn, they all spawn on the same spot.
pawn Код:
forward LootRespawn();
public LootRespawn()
{
new res = randomEx(1, 2);
new amount = randomEx(1, 10);
new Locs = random(sizeof(TestSpawns));
if(res == 1)
{
CreateItem(1580, amount, 1, TestSpawns[Locs][0], TestSpawns[Locs][1], TestSpawns[Locs][2], 0, 0);
CreateItem(1577, amount, 1, TestSpawns[Locs][0], TestSpawns[Locs][1], TestSpawns[Locs][2], 0, 0);
CreateItem(373, amount, 1, TestSpawns[Locs][0], TestSpawns[Locs][1], TestSpawns[Locs][2], 0, 0);
CreateItem(348, 1, 1, TestSpawns[Locs][0], TestSpawns[Locs][1], TestSpawns[Locs][2], 0, 0);
}
if(res == 2)
{
CreateItem(2806, amount, 1, TestSpawns[Locs][0], TestSpawns[Locs][1], TestSpawns[Locs][2], 0, 0);
CreateItem(2663, amount, 1, TestSpawns[Locs][0], TestSpawns[Locs][1], TestSpawns[Locs][2], 0, 0);
CreateItem(335, 1, 1, TestSpawns[Locs][0], TestSpawns[Locs][1], TestSpawns[Locs][2], 0, 0);
CreateItem(2358, amount, 1, TestSpawns[Locs][0], TestSpawns[Locs][1], TestSpawns[Locs][2], 0, 0);
}
pawn Код:
new Float: TestSpawns[][] =
{
{377.64130, 2542.36963, 15.53980},
{381.50552, 2542.74146, 15.53976},
{381.19205, 2539.23486, 15.54050},
{378.27368, 2539.07715, 15.54048}
};