26.11.2011, 16:07
%.2f specifies the precision of the float to print out to 2. This would print out a float to 2 decimal places:
For more info, see this article I wrote on the wiki about floats:
https://sampwiki.blast.hk/wiki/Floats
and more specifically;
https://sampwiki.blast.hk/wiki/Floats#Float_-.3E_String
pawn Код:
// ..
printf( "%.2f", 3.141592 );
//Would output 3.14, because precision is 2 places.
// ..
printf( "%f", 3.141592 );
//Would output 3.141592, because there is no precision set.
// ..
printf( "%.4f", 3.141592 );
//Would output 3.1415, because precision is 4 places.
https://sampwiki.blast.hk/wiki/Floats
and more specifically;
https://sampwiki.blast.hk/wiki/Floats#Float_-.3E_String