15.10.2010, 21:43
Quote:
pawn Код:
|
integer / integer = integer
Integers have the numbers after their decimal point truncated (cut off), so 0.9, 0.333, 0.4 etc. would become 0. That also means any value of the calculation 'playerStats[playerid][pGunSkill]/50' would become 0 since pGunSkill is always lower than 50.
In order to fix it you can do two solutions:
- Skip the division and do what Babul suggested. Probably what I'd suggest except you would not get anyone with 100% -- to get 100% then multiple by 2.04081633 (100/49) instead, since your maximum value is 49.
- Change the '50' to '50.0' and '100' to '100.0' OR use floatdiv and floatmul. You may also need to use float(playerStats[playerid][pGunSkill]) to convert the gun skill to a float making it pure float multiplication/division (I can't remember how Pawn copes with mixed ints/floats)