SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 08/07/2012, 11:33 AM   #1
dogman
Big Clucker
 
dogman's Avatar
 
Join Date: May 2010
Posts: 56
Reputation: 3
Question 4digit random number

Hi,
I have made this script:
Code:
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
__________________
dogman is offline   Reply With Quote
Old 08/07/2012, 11:40 AM   #2
ReneG
High-roller
 
Join Date: Oct 2011
Location: Sublime Text 2
Posts: 1,906
Reputation: 337
Default Re: 4digit random number

4 slots.

The first random number is 3 digits.

You get it?

Only allow 1 digit numbers.

EDIT:
pawn Code:
for(new i=0;i<4;i++)
{
      randnumber[i] = random(10);
}
Will choose numbers 0-9 randomly.
ReneG is offline   Reply With Quote
Old 08/07/2012, 11:43 AM   #3
dogman
Big Clucker
 
dogman's Avatar
 
Join Date: May 2010
Posts: 56
Reputation: 3
Default Re: 4digit random number

you are right dum dum me :P
__________________
dogman is offline   Reply With Quote
Old 08/07/2012, 11:44 AM   #4
clarencecuzz
Gangsta
 
Join Date: Jul 2010
Location: Australia
Posts: 928
Reputation: 92
Default Re: 4digit random number

EDIT: Too late
clarencecuzz is offline   Reply With Quote
Old 08/07/2012, 12:05 PM   #5
Stylock
Huge Clucker
 
Stylock's Avatar
 
Join Date: Dec 2010
Posts: 315
Reputation: 155
Default Re: 4digit random number

Random four digit number
Code:
random(8999) + 1000
Stylock is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
doing random number with number range defined henry jiggy Help Archive 3 10/08/2011 10:59 PM
[Include] Insanity Random Lists(generate a random number from your list) CyNiC Includes 10 23/07/2011 01:45 PM
4digit random numbers THE_KNOWN Help Archive 7 18/01/2011 12:14 PM
new mode = random(1); lets pawno crash + mode = random number FOR all public's hipy Help Archive 3 23/07/2009 08:50 PM
Random number, then pick string out of an array depending on number? Robbin237 Help Archive 2 26/02/2009 06:26 PM


All times are GMT. The time now is 12:50 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.