*** I can't name topics well!
#1

Hey guys I'm going to ask some n00bish questions here. But what I want to find out will require more than searching. Anyway Here is what I would like to ask.

I want to get a percentage from a string. For example

String which I called TeamHealth which may vary depending on the amount of players. So TeamHealth holds the total health of all the players.

Now I want to work out (let's say) 67% of that value

Код:
        if (TeamHealth == <67%>)
        {
trigger event
        }

And last I want to know how to make an orange textdraw because I'm using ~r~~y~ and that does not work.
Reply
#2

Not sure if there is a way to work out a percentage through a function, but you can do it mathematically.

Max HP (divided by) HP (multiplied by) 100 = %

So you could do something like this:

pawn Код:
new
    Float:Health,
    percentage = 100/Health*100;
But, the max health you can have (normally) is 100 so if you have 67/100 HP then it's 67%.
Reply
#3

Thanks for the start I'll use *0.67 for my percent working out to keep it efficient
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)