SA-MP Forums Archive
Float help! - 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: Float help! (/showthread.php?tid=534320)



Float help! - dieuhanhphuc - 29.08.2014

i have a float value: 0.33412359.
And i want to show this float 0.3 or 0.33! Help me


Re: Float help! - Stinged - 29.08.2014

Try %.2f


Re: Float help! - Thogy - 29.08.2014

&f replace by %0.2f


Re: Float help! - [XST]O_x - 29.08.2014

pawn Код:
new Float: myFloat = 0.33412359;

printf("Original value: %f", myFloat);
printf("Only 1 number: %.1f", myFloat);
printf("Only 2 numbers: %.2f", myFloat);
pawn Код:
//Prints:/*
Original value: 0.334123
Only 1 number: 0.3
Only 2 numbers: 0.33
*/