Question regarding random - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Question regarding random (
/showthread.php?tid=132976)
Question regarding random -
westre - 10.03.2010
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.
Re: Question regarding random -
Anwix - 10.03.2010
pawn Code:
new rnd = random(sizeof(zones));
SetPlayerCheckpoint(playerid,zones[rnd][X1],zones[rnd][Y1],zones[rnd][Z1],30.0);
Re: Question regarding random -
westre - 10.03.2010
Cheers.