Posts: 2,286
Threads: 18
Joined: Jun 2010
Quote:
Originally Posted by SaYrOn
Why are you checking if result is equal or below?
If random will return 5, it will go through both of above if-statements. And chance will be equaled to 40.
You should rather check if result is in between two values, smth like:
pawn Код:
if(result >= 30 && result <= 39) { do something } //30% if(result >= 40 && result <= 49) { do something } //40%
|
What the fuck. The OP wants a 30% chance, not the value being between 30 and 40. 39-30 = 9, which means there will be a 9 percent chance. Go learn some simple maths please. This was just an example. I showed them how to calculate percentage.