SA-MP Forums Archive
strval - 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: strval (/showthread.php?tid=451871)



strval - NeroX98 - 18.07.2013

Hi guys...

I have Phone system with 9 numbers

Here is the code:
pawn Код:
new randphone = 100000 + random(899999);
format(stringbroj, sizeof(stringbroj), "071%d", randphone)
broj = strval(stringbroj)
printf("%d", broj)
When printing i get 71XXXXXX(8 numbers)... WHERE IS 0 (ZERO)


Re: strval - fordawinzz - 18.07.2013

pawn Код:
new randphone = 71000000;
randphone += (100000 + random(899999));
printf("%09d", randphone);
possible result: 071899588


Re: strval - Kirollos - 19.07.2013

Because '0' in the beginning a whole number (in mathematics) has no meaning.

tho the solution of the guy above me is correct.