Completely Random License Plate? - 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)
+--- Thread: Completely Random License Plate? (
/showthread.php?tid=480634)
Completely Random License Plate? -
Dokins - 11.12.2013
pawn Код:
#define MAX_PASS 8
new charset[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
new newPass[MAX_PASS];
for(new i = 0; i < MAX_PASS; i++)
{
newPass[i] = charset[RandomEx(0, sizeof(charset))]; // 62 = strlen of charset
}
format(plate, sizeof(plate), "%s",newPass);
This sometimes doesn't make it 8 characters, sometimes 1, sometimes 2. What's the issue here?
Re: Completely Random License Plate? -
Jefff - 11.12.2013
pawn Код:
new newPass[MAX_PASS + 1];
and
Re: Completely Random License Plate? -
Dokins - 11.12.2013
Thank you.