Question regarding random
#1

So yeah, I have this code:

Code:
#define MAX_ZONES 3
Code:
enum zoneE {
	zoneID,
	zoneName[40],
	Float:X1,
	Float:Y1,
	Float:Z1
}
Code:
new zones[MAX_ZONES][zoneE] = {
{ 0, "LS-AP", 1984.6093,-2382.9136,13.5469},
{ 1, "VM-AP", 365.2383,2537.9409,16.6654},
{ 2, "LV-AP", 1608.6620,1628.3066,10.8203}
};
It works but for some reason if I try to use random, it always shows up LV-AP. Either I have 100% bad luck that it chooses LV-AP all the time or I have made a mistake in the code.

Code:
new rnd = random(sizeof(zones));
SetPlayerCheckpoint(playerid,zones[i][X1],zones[i][Y1],zones[i][Z1],30.0);
Help would be appreciated, thanks.
Reply
#2

pawn Code:
new rnd = random(sizeof(zones));
SetPlayerCheckpoint(playerid,zones[rnd][X1],zones[rnd][Y1],zones[rnd][Z1],30.0);
Reply
#3

Cheers.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)