Help Float
#1

So the the Float are 1.000000, 6 decimals
new strc[128],Float:realnum,decimals;
format(strc,sizeof(strc),"%.%df",realnum,decimals) ;
decimals = 2;
so the float should return 1.00, but don't work
Reply
#2

Try this:
PHP код:
new strc[128],Float:realnum,decimals;
format(strc,sizeof(strc),"%%.%df",decimals); //output %%.2f
format(strc,sizeof(strc),strc,realnum); //output %.2f 
Reply
#3

PHP код:
new strc[128],Float:realnum;
format(sstrcsizeof(strc), "%.2f"realnum); 
As of using %.2f, it will limit the place holders to 2 after the decimal points.
Reply
#4

Thanks, Solved
Reply
#5

PHP код:
format(strc,sizeof(strc),"%.%df",realnum,decimals) ; 
You should place "decimals" before "realnum" argument.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)