[Help] Float number alignment
#1

pawn Код:
format( myString, sizeof( myString ), " X = %04.02f~n~ Y = %04.02f~n~ Z = %04.02f~n~ A = %03.02f", c_x, c_y, c_z, c_a );
(It's gonna be used on a TextDraw, thats why I'm using ~n~ instead of \n)

I want it to show like:

Quote:

X = 0960.01
Y = 1000.50
Z = 0007.08
A = 050.80

I managed to do it with Integers, but how can I do it with Float points?

Thanks in advance.

EDIT#_____________________________________________ ______________

I am sorry, I should have explained a little more specific of what I wanted.

Imagine a digital clock:

Quote:

08:36 h
04:05 h

If you notice, it always shows a zero even if the hours/minutes value is below 10.
Quote:

X = 0960.01
Y = 1000.50
Z = 0007.08
A = 050.80

( the Angle never goes up from 360 so, I just want it to show 3 algoritms.

That's why I mentioned that I managed to do it with integers, if you do:
pawn Код:
printf( "%03d", 12 );
It will print:
Quote:

012

Reply
#2

Your supposed to do it like this.

pawn Код:
new Float:X,Float:Y,Float:Z, myString[128]; GetPlayerPos(playerid,X,Y,Z);
format(myString,sizeof(myString),"X = %0.1f, Y = %0.1f, Z = %0.1f",X,Y,Z);
SendClientMessage(playerid,COLOR,myString);
print(myString);
Reply
#3

lol..
pawn Код:
format( myString, sizeof( myString ), "X = %0.2f~n~Y = %0.2f~n~Z = %0.2ff~n~A = %3.2f", c_x, c_y, c_z, c_a);
that should do it?
Reply
#4

warped this post to the first one
Reply
#5

bump . . . .
Reply
#6

http://pastebin.com/arZgz2Ah
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)