Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: Lesbian on Dec 06, 2017, 01:34 PM

Title: Ratio on irc bugged
Post by: Lesbian on Dec 06, 2017, 01:34 PM
what's the problem / i use it on irc

(https://s33.postimg.org/3jsxytg67/xxd.png)
Title: Re: Ratio on irc bugged
Post by: Murdock on Dec 07, 2017, 08:44 AM
I think the problem is a division by zero, not sure though
Title: Re: Ratio on irc bugged
Post by: Lesbian on Dec 07, 2017, 08:47 AM
Quote from: Murdock on Dec 07, 2017, 08:44 AMI think the problem is a division by zero, not sure though
Hi murdock Thanks for your help you're right it  was division with zero.Any way to stop it ? mean if the kills are 0 then it don't gives ratio 
Title: Re: Ratio on irc bugged
Post by: ! on Dec 07, 2017, 10:24 AM
Replace it with.
local ratio = 0;
if ( GetSQLColumnData( q, 4 ) != 0 && GetSQLColumnData( q, 5 ) != 0 ) {
   ratio = format( "%.2f", GetSQLColumnData( q, 4 ) / GetSQLColumnData( q, 5 ) );
}