not so random, random spawns :)
#6

pawn Code:
new Float:coords[][4] =
{
{X, Y, Z, A},
{X, Y, Z, A}.
{X, Y, Z, A},
{X, Y, Z, A}
};

new rand = random(sizeof(coords));
SetPlayerPos(playerid, coords[rand][0], coords[rand][1], coords[rand][2]);
SetPlayerFacingAngle(playerid, coods[rands][3]);
Random(sizeof(coords)); will get a random slot out of sizeof coords (which is empty, so the compiler will calculate automaticly)
So if random picks 1 (out of 4) it will then store that into rand.

Then you're setting pos via coords[rand][0], so if random picks 1 and stores that into rand, rand is 1, so it's basicly saying:
coords[1][0], remember you're calling it once, not calling it when you use coords[rand][0].

Simpler:

Random picks a number out of how many sets there are, stores the number into rand, then you're using rand (which is a number).
Reply


Messages In This Thread
not so random, random spawns :) - by iggy1 - 21.05.2010, 07:38
Re: not so random, random spawns :) - by cessil - 21.05.2010, 07:43
Re: not so random, random spawns :) - by iJumbo - 21.05.2010, 07:46
Re: not so random, random spawns :) - by iggy1 - 21.05.2010, 07:52
Re: not so random, random spawns :) - by Cank - 26.05.2010, 11:35
Re: not so random, random spawns :) - by Joe_ - 26.05.2010, 11:50

Forum Jump:


Users browsing this thread: 1 Guest(s)