Question About Textdraw/Positions [SOLVED]
#1

Hi...
I just wanted to make a textdraw which show's you the ZAngle of your vehicle, but it shows me something like: 90.91932 now.
How can i make it show only "90"?

(i got this:
new Float:az, string[256];
TextDrawDestroy(tpanel);
TextDrawHideForPlayer(playerid, tpanel);
GetVehicleZAngle(v, az);
format(string, sizeof(string), "%f", az);
tpanel= TextDrawCreate(200.0, 200.2, string);
TextDrawFont(tpanel, 1);
TextDrawSetOutline(tpanel, 1);
TextDrawColor(tpanel, GREEN);
)

Thx

TextDrawShowForPlayer(playerid, tpanel);
Reply
#2

use floatround, look the function at the wiki page up

And you dont need to destroy / create each time your textdraw, there is a nice function called TextDrawSetString
Reply
#3

Ok thank you:P..ill check it out
Reply
#4

Ehm..i tried that floatround but, how can i get it to show the floatround?
Reply
#5

%.0f instead of %f
Reply
#6

i got that:

new Float:az, string[256];
TextDrawDestroy(tpanel);
TextDrawHideForPlayer(playerid, tpanel);
GetVehicleZAngle(v, az);
floatround(az, floatround_round);
format(string, sizeof(string), "%0f", az);
tpanel= TextDrawCreate(200.0, 200.2, string);
TextDrawFont(tpanel, 1);
TextDrawSetOutline(tpanel, 1);
TextDrawColor(tpanel, GREEN);
TextDrawShowForPlayer(playerid, tpanel);


and it still shows the 90.213451
Reply
#7

Quote:
Originally Posted by //exora
%.0f instead of %f
Your code :
Код:
format(string, sizeof(string), "%0f", az);
Reply
#8

ouch, I overread the ".":P
It works now, thanks for your help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)