Simple maths (percentage)
#1

Okay it's 4AM so my brain is nowhere to be found. I have 2 variables; total_wins and my_wins. I want it to display to the player what percentage of wins are theirs. What maths do I need for this?
Reply
#2

(my_wins / total_wins) = percentage
Reply
#3

(my_wins / total_wins)*100 = percentage

that will get you a percentage.
Reply
#4

pawn Код:
floatround((my_wins / total_wins)*100, floatround_round);
You can also use this to prevent percentage be a float
Reply
#5

When I do

(my_wins/total_wins)*100

it returns as 0...
Reply
#6

Are the variable stored correctly/used correctly?
Reply
#7

Try doing
(my_wins/total_wins*100) you may be getting errors having the *100 outside of the parenthesis, and also check what Lorenc_ said most likely it is the variables not being stored right.
Reply
#8

I changed them to floats and it worked >.>
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)