Textdraw width help -
Jstylezzz - 23.02.2013
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
Re: Textdraw width help -
Misiur - 23.02.2013
https://sampforum.blast.hk/showthread.php?tid=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)
Re: Textdraw width help -
Jstylezzz - 23.02.2013
Quote:
Originally Posted by Misiur
|
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
Re: Textdraw width help -
Misiur - 23.02.2013
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
Re: Textdraw width help -
Jstylezzz - 23.02.2013
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