Items spawn on same coords
#1

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}
};
Reply


Messages In This Thread
Items spawn on same coords - by DTV - 10.05.2015, 02:57
Re: Items spawn on same coords - by RoboN1X - 10.05.2015, 04:04
Re: Items spawn on same coords - by DTV - 10.05.2015, 05:00
Re: Items spawn on same coords - by RoboN1X - 10.05.2015, 07:09
Re: Items spawn on same coords - by DTV - 10.05.2015, 12:22
Re: Items spawn on same coords - by DTV - 10.05.2015, 20:53
Re: Items spawn on same coords - by DTV - 12.05.2015, 02:24
Re: Items spawn on same coords - by Joe Staff - 12.05.2015, 03:19
Re: Items spawn on same coords - by Joe Staff - 12.05.2015, 04:12
Re: Items spawn on same coords - by DTV - 12.05.2015, 06:18

Forum Jump:


Users browsing this thread: