SA-MP Forums Archive
[ASK] How to make a string 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: [ASK] How to make a string random (/showthread.php?tid=201841)



[ASK] How to make a string random - hack4ever - 22.12.2010

Okay, i just want ask how to make a string value. If you don't know what i mean, i'll make a illustration.

-I want set a vehicle number plate. Then, i want make the the number plate combination between letters and numbers.
-Example : "XYZ 1903" .

Then, my question is : How to make a random value for "XYZ" ?

And sorry for my bad english.


Re: [ASK] How to make a string random - WillyP - 22.12.2010

Easy, but why do loads of people say 'sorry for my bad english' yet their post was near-enough perfect English..?


Re: [ASK] How to make a string random - RyDeR` - 22.12.2010

Like this:
pawn Код:
string[n] = random(26) + 'A';



Re: [ASK] How to make a string random - Hal - 22.12.2010

experiment with random like Ryder showed above.
Here is the wiki link to explain how it works because its hard to explain here. It's pretty easy to use though
https://sampwiki.blast.hk/wiki/Random