I've tried different ways to do it but it just won't work. When I have fired 1395 shots and hit 1336 monsters, Zandronum will say that my hit ratio is 95,1075% but if I calculate it using a calculator, the calculator displays 95,77060931899642 (95,77 for short).
It seems to me it's the modulus operator (%) that's the problem.
Any suggestions?
Code:
Code: Select all
Int Shots = GetCVar("x_doomstats_shots");
Int Missed = GetCVar("x_doomstats_missed");
Int Hits = Shots - Missed;
If(Hits != 0 && Shots != 0)
{
Int HitRatio = (Hits * 100); //133600
Int HitRatioRemainderInt = (HitRatio % Shots); //1075 ???
Int HitRatioComplete = HitRatio / Shots; //95
Str HitRatioStr = StrParam(s:HitRatioComplete, s:",", d:HitRatioRemainderInt, s:"%"); //95,1075% - Should be 95,77%
}
[/spoiler]