SA-MP Forums Archive
[HELP] Random Numbers - 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: [HELP] Random Numbers (/showthread.php?tid=205197)



[HELP] Random Numbers - psoftware - 31.12.2010

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.


Re: [HELP] Random Numbers - <Weponz> - 31.12.2010

#define MAX_RAND_NUM 99999999999

??


Re: [HELP] Random Numbers - psoftware - 31.12.2010

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


Re: [HELP] Random Numbers - DeathOnaStick - 31.12.2010

Quote:
Originally Posted by psoftware
Посмотреть сообщение
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 Код:
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?


Re: [HELP] Random Numbers - <Weponz> - 31.12.2010

Use this function..

pawn Код:
Random(100000000000);
Will return a value from 0-99999999999


Re: [HELP] Random Numbers - Joe Staff - 31.12.2010

You guys don't seem to realize that you cannot create a number larger than 2147483647 (0x7FFFFFFF).


Re: [HELP] Random Numbers - psoftware - 31.12.2010

Thank you DeathOnaStick , but i have another problem. How do i do if i want save this value with dini


Re: [HELP] Random Numbers - DeathOnaStick - 31.12.2010

Quote:
Originally Posted by psoftware
Посмотреть сообщение
Thank you DeathOnaStick , but i have another problem. How do i do if i want save this value with dini
pawn Код:
dini_Set(filename, "Name", string);
In this case "Name" is the name, the string is assigned to.

Quote:
Originally Posted by SilentHuntR
Посмотреть сообщение
You guys don't seem to realize that you cannot create a number larger than 2147483647 (0x7FFFFFFF).
I did.