SA-MP Forums Archive
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: random (/showthread.php?tid=191294)



random - GaGlets(R) - 18.11.2010

I though i will never need this feature, but now its different.

Just wondering, how could i random only 2 to 3 capital letters "ABCDEFGH" and in the result would be only 3 of them randomed order.

the same question about numbers

and how would i `format` results

And the last questions.
How could i Check if in string are atleast 2 Capital leters and some numbers.
Just asking for my custom vehicle license(or licence) plate
e.g. LK-12551, HGS-9384 etc.


Re: random - Sascha - 18.11.2010

maybe something like:

Код:
new RandLet[][] = {
"A",
"B",
etc...
};

new RandNum[][] = {
1,
2,
3,
etc
}
Where you need it:
Код:
new place[3];
new n = random(sizeof(RandNum));
place[0] = RandNum[n];
n = random(sizeof(RandNum));
place[1] = RandNum[n];
n = random(sizeof(RandNum));
place[2] = RandNum[n];
same with letters...