Originally Posted by Touch
I need to calculate the ratio player.
But there are problems with the script.
If I did not kill anybody or himself is not dead, then the script in console an error.
But if, as I had killed himself died a few times, then my ratio = 0.00000.
new userkills = GetClientFrags(client);
new userdeaths = GetClientDeaths(client);
ratio = userkills / userdeaths;
Why is my ratio 0.0000?
Simple. as you know, in math the denominator can't be '0'
so the error shows up. (you should make special script for that case
if(userdeahts == 0)
ratio = xx (u can do something u want. I mean just substitute u want)
else if(userdeaths > 0)
ratio = float(userkills)/float(userdeath) or FloatDiv(float(userkill)/float(userdealth))
and if u want to divide float with float
It would be more better to use
* Divides the dividend by the divisor.
* @param dividend First value.
* @param divisor Second value.
* @return dividend/divisor.
native Float:FloatDiv(Float:dividend, Float:divisor);
but if u want to round the float, just use
one more thing which is strange is that the ratio.
I think ratio should be under 100%.
ratio = userkill / (userdeath+userkill)