SA-MP Forums Archive
How can i make random numbers like that? - 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: How can i make random numbers like that? (/showthread.php?tid=463130)



How can i make random numbers like that? - Kapone21 - 10.09.2013

I want a "random" script to create a number like that: 0728799808 Well i want to start with 072 and 7 numbers... how?


Re: How can i make random numbers like that? - Twizted - 10.09.2013

I honestly could not understand you, but well, if you want something to be random, use this:

https://sampwiki.blast.hk/wiki/Random


Re: How can i make random numbers like that? - Dragonsaurus - 10.09.2013

pawn Код:
new phone[11];
new number = random(9999999);
if(number < 1000000) format(phone, sizeof(phone), "0%i", number);
format(phone, sizeof(phone), "072%s", phone);



Re: How can i make random numbers like that? - Konstantinos - 10.09.2013

I'd use something like that!
pawn Код:
new
    phone[ 11 ]
;
format( phone, sizeof( phone ), "072%d%d%d%d%d%d%d", random( 10 ), random( 10 ), random( 10 ), random( 10 ), random( 10 ), random( 10 ), random( 10 ) );