SA-MP Forums Textdraw width help
 User Name Remember Me? Password
 New Account Members List Search Today's Posts Mark Forums Read

 Thread Tools Display Modes
 23/02/2013, 08:13 PM #1 Jstylezzz High-roller     Join Date: Sep 2011 Location: Netherlands Posts: 1,835 Reputation: 1550 Textdraw width help Hi everyone, I made some progress bars with normal textdraws (since I couldn't find any easy to use progress bar includes), but now I have to find some formula to calulate the width of a textdraw, corresponding to the percentage given. Example: Testvalue = 100.0 Textdraw width = 55.000 Testvalue = 27.432 Textdraw width = The textdraw width goes from 55 to 5, so it can decrease by maximum 50. Now, can anyone think of a formula to get the width with the Testvalue? Or, can someone tell me a better way to do it? Thanks in advance
 23/02/2013, 08:16 PM #2 Misiur High-roller     Join Date: Jul 2009 Location: Poland Posts: 2,529 Reputation: 554 Re: Textdraw width help http://forum.sa-mp.com/showthread.php?t=113443 - easy to use I think what you need are proportions (you call them that in english?) current_width = max_width * (current_value / max_value) __________________ My tech blog - some YSI tutorials, currently not actively maintained
23/02/2013, 08:28 PM   #3
Jstylezzz
High-roller

Join Date: Sep 2011
Location: Netherlands
Posts: 1,835
Reputation: 1550
Re: Textdraw width help

Quote:
 Originally Posted by Misiur http://forum.sa-mp.com/showthread.php?t=113443 - easy to use I think what you need are proportions (you call them that in english?) current_width = max_width * (current_value / max_value)
I think they're called proportions yeah..
I tried that progress bar include already, but my compiler crashes if I create a bar, so I can't use that
Thanks for your formula thing, I will try to play around with that

EDIT: I tried your formula, and it works when I log in for the first time, after that, it isn't getting updated (checked with a command to set everything to 100).
Could this be because I need to destroy the textdraw and create it again?
Idk, until I find a good solution I will try to get that progress bar thing to work

 23/02/2013, 08:37 PM #4 Misiur High-roller     Join Date: Jul 2009 Location: Poland Posts: 2,529 Reputation: 554 Re: Textdraw width help Oh, and if Testvalue is simply percentage, then it will be current_width = max_width * (Testvalue / 100) @edit: Currently I'm learning about textdraws too, I don't know when they are updated, but I think you have to destroy it and recreate :c __________________ My tech blog - some YSI tutorials, currently not actively maintained
 23/02/2013, 08:48 PM #5 Jstylezzz High-roller     Join Date: Sep 2011 Location: Netherlands Posts: 1,835 Reputation: 1550 Re: Textdraw width help Yeah, was already afraid of that :P Anyways, I changed some stuff in the include, and it works Thanks alot for the suggestion, else I wouldn't tried it again I think :P Good luck with the textdraw stuff

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post zSuYaNw Scripting Help 1 01/10/2012 08:32 PM Deal-or-die Scripting Help 4 11/07/2012 04:56 AM NoZ Scripting Help 9 06/03/2012 03:44 AM DarkScripter Scripting Help 3 04/03/2012 07:57 PM spd_sahil Scripting Help 1 18/01/2012 02:13 PM

All times are GMT. The time now is 10:34 PM.

 -- (EN) English -- (RU) Русски SA-MP - Archive - Top