SA-MP Forums Archive
Question About Textdraw/Positions [SOLVED] - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Question About Textdraw/Positions [SOLVED] (/showthread.php?tid=144021)



Question About Textdraw/Positions [SOLVED] - Sascha - 25.04.2010

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);


Re: Question About Textdraw/Positions - Nero_3D - 25.04.2010

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


Re: Question About Textdraw/Positions - Sascha - 25.04.2010

Ok thank you:P..ill check it out


Re: Question About Textdraw/Positions - Sascha - 25.04.2010

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



Re: Question About Textdraw/Positions - woot - 25.04.2010

%.0f instead of %f


Re: Question About Textdraw/Positions - Sascha - 25.04.2010

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



Re: Question About Textdraw/Positions - Rac3r - 25.04.2010

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



Re: Question About Textdraw/Positions - Sascha - 25.04.2010

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