View Single Post
Lord Canistra
Senior Member
Join Date: Mar 2009
Location: Tallinn, Estonia
Old 08-31-2010 , 09:03   Re: Dividing the numbers in sourcemod
Reply With Quote #12

>if userdeaths is 0, your script will
Oh my, just noticed division by zero ftw!

iirc RoundToNearest will return rounded integer. I assume Touch needs to shorten number count past comma.
In this case, you can reduce it in this way:
PHP Code:
PrintToChatAll("%.2f"ratio); 
, where 2 is count of numbers past comma. In example given above, it would turn 2.000000 into 2.00 . Adjust this to your liking, also, you can use this formatting method in most print/format functions.
__________________
Lord Canistra is offline