SA-MP Forums

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

 
 
Thread Tools Display Modes
Old 31/12/2010, 05:26 PM   #1
psoftware
Little Clucker
 
psoftware's Avatar
 
Join Date: Oct 2010
Location: Italy, Potenza, Basilicata
Posts: 32
Reputation: 0
Angry [HELP] Random Numbers

Hello!! In my gamemode i found many problems with random numbers. I want to do a random number min than 99999999999 and major than 00000000000. Can you tell me the solution??

N.B. The number must be eleven digits and sorry for my english, i'm italian.
psoftware is offline  
Old 31/12/2010, 05:35 PM   #2
<Weponz>
Huge Clucker
 
<Weponz>'s Avatar
 
Join Date: Jul 2010
Location: Program Files/Scripts/Weponz/Pawno
Posts: 459
Reputation: 1
Default Re: [HELP] Random Numbers

#define MAX_RAND_NUM 99999999999

??
__________________
Quote:
Originally Posted by __
1) I'm not fat
2) I'm smart
3) I have a normal life
4) Again, I have a normal life and I'm smart
Quote:
Originally Posted by Geso
I like talking to people like this, makes me feel smart xD
<Weponz> is offline  
Old 31/12/2010, 05:52 PM   #3
psoftware
Little Clucker
 
psoftware's Avatar
 
Join Date: Oct 2010
Location: Italy, Potenza, Basilicata
Posts: 32
Reputation: 0
Default Re: [HELP] Random Numbers

You didn't understand me. I want to do a string like this x.x.x.x.x.x.x.x.x.x.x where x are random numbers from 0 to 9
psoftware is offline  
Old 31/12/2010, 05:58 PM   #4
DeathOnaStick
High-roller
 
DeathOnaStick's Avatar
 
Join Date: May 2009
Location: 127.0.0.1
Posts: 1,028
Reputation: 27
Default Re: [HELP] Random Numbers

Quote:
Originally Posted by psoftware View Post
You didn't understand me. I want to do a string like this x.x.x.x.x.x.x.x.x.x.x where x are random numbers from 0 to 9
pawn Code:
new string[20];
format(string, sizeof(string), "%i.%i.%i.%i.%i.%i.%i.%i.%i", random(10), random(10), random(10), random(10), random(10), random(10), random(10), random(10), random(10), random(10));
print(string);

Try it. You want it like this?
DeathOnaStick is offline  
Old 31/12/2010, 06:00 PM   #5
<Weponz>
Huge Clucker
 
<Weponz>'s Avatar
 
Join Date: Jul 2010
Location: Program Files/Scripts/Weponz/Pawno
Posts: 459
Reputation: 1
Default Re: [HELP] Random Numbers

Use this function..

pawn Code:
Random(100000000000);

Will return a value from 0-99999999999
__________________
Quote:
Originally Posted by __
1) I'm not fat
2) I'm smart
3) I have a normal life
4) Again, I have a normal life and I'm smart
Quote:
Originally Posted by Geso
I like talking to people like this, makes me feel smart xD
<Weponz> is offline  
Old 31/12/2010, 06:05 PM   #6
Joe Staff
High-roller
 
Join Date: Aug 2007
Posts: 2,593
Reputation: 379
Default Re: [HELP] Random Numbers

You guys don't seem to realize that you cannot create a number larger than 2147483647 (0x7FFFFFFF).
Joe Staff is offline  
Old 31/12/2010, 06:10 PM   #7
psoftware
Little Clucker
 
psoftware's Avatar
 
Join Date: Oct 2010
Location: Italy, Potenza, Basilicata
Posts: 32
Reputation: 0
Default Re: [HELP] Random Numbers

Thank you DeathOnaStick , but i have another problem. How do i do if i want save this value with dini
psoftware is offline  
Old 31/12/2010, 06:14 PM   #8
DeathOnaStick
High-roller
 
DeathOnaStick's Avatar
 
Join Date: May 2009
Location: 127.0.0.1
Posts: 1,028
Reputation: 27
Default Re: [HELP] Random Numbers

Quote:
Originally Posted by psoftware View Post
Thank you DeathOnaStick , but i have another problem. How do i do if i want save this value with dini
pawn Code:
dini_Set(filename, "Name", string);

In this case "Name" is the name, the string is assigned to.

Quote:
Originally Posted by SilentHuntR View Post
You guys don't seem to realize that you cannot create a number larger than 2147483647 (0x7FFFFFFF).
I did.
DeathOnaStick is offline  
 

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
[Help] Random numbers Rainbow_Six Help Archive 4 21/10/2010 06:08 PM
Random Selecting Numbers Kyle Help Archive 2 09/08/2010 02:11 PM
Random Cellphone Numbers Torran Help Archive 1 02/04/2010 07:51 PM
[HELP] Random numbers? SiJ Help Archive 6 09/08/2009 02:14 PM
Need help with random numbers... *BueNoOo* Help Archive 11 18/06/2009 04:13 PM


All times are GMT. The time now is 04:28 AM.


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