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



4digit random number - dogman - 08.07.2012

Hi,
I have made this script:
Код:
carId = AddStaticVehicleEx(vehicletype,SpawnX,SpawnY,SpawnZ,SpawnRot,Color1,Color2,(30*60)); 
for(new i=0;i<4;i++)
{
      randnumber[i] = random(9999);
}
format(numplate_test,32,"{F81414}TL{000000}%d",randnumber[1]);
SetVehicleNumberPlate(carId, numplate_test);
This will output a number plate like: TL(4 digit number)
but in some cases it will output only 1,2 or 3 digits
I don't no what i am doing wrong help me


Re: 4digit random number - ReneG - 08.07.2012

4 slots.

The first random number is 3 digits.

You get it?

Only allow 1 digit numbers.

EDIT:
pawn Код:
for(new i=0;i<4;i++)
{
      randnumber[i] = random(10);
}
Will choose numbers 0-9 randomly.


Re: 4digit random number - dogman - 08.07.2012

you are right dum dum me :P


Re: 4digit random number - clarencecuzz - 08.07.2012

EDIT: Too late


Re: 4digit random number - Stylock - 08.07.2012

Random four digit number
Код:
random(8999) + 1000