Raised This Month: $ Target: $400
 0% 

Calculating, k/d ratio.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Santaaa
BANNED
Join Date: May 2012
Old 07-09-2012 , 17:37   Calculating, k/d ratio.
Reply With Quote #1

Hello there,

For example someone has a 1.41 k/d ratio and he will unlock an achievement with a 1.50 k/d ratio how will I check if the user has a 1.50 k/d ratio?
Santaaa is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 07-09-2012 , 17:43   Re: Calculating, k/d ratio.
Reply With Quote #2

deaths = get deaths
if deaths is 0, deaths = 1
ratio = get frags / deaths
if ratio is greater than or equal to 1.5, then give achievment
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Santaaa
BANNED
Join Date: May 2012
Old 07-09-2012 , 17:47   Re: Calculating, k/d ratio.
Reply With Quote #3

Yea, my question was how will i check if its higher then 1,5?

Can i just use for example if (Ratio >= 1.5)

Last edited by Santaaa; 07-09-2012 at 17:48.
Santaaa is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 07-09-2012 , 17:51   Re: Calculating, k/d ratio.
Reply With Quote #4

Compiling and testing do wonders.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Santaaa
BANNED
Join Date: May 2012
Old 07-09-2012 , 17:53   Re: Calculating, k/d ratio.
Reply With Quote #5

does it need 2 decimals?

Last edited by Santaaa; 07-09-2012 at 17:53.
Santaaa is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 07-09-2012 , 18:44   Re: Calculating, k/d ratio.
Reply With Quote #6

Quote:
Originally Posted by Santaaa View Post
does it need 2 decimals?
two decimals??

1..5?
Doc-Holiday is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-09-2012 , 19:08   Re: Calculating, k/d ratio.
Reply With Quote #7

Use floats in the equation, if that's what you meant.
__________________
Bugsy is offline
isotonic
AlliedModders Donor
Join Date: Jun 2011
Location: Moscow, Russia
Old 07-09-2012 , 19:56   Re: Calculating, k/d ratio.
Reply With Quote #8

PHP Code:
new Float:ratio
ratio 
get frags deaths
if ( ratio >= 1.5 ) { 
Only floats could have fractional part.
__________________

Last edited by isotonic; 07-09-2012 at 19:57.
isotonic is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-09-2012 , 21:01   Re: Calculating, k/d ratio.
Reply With Quote #9

PHP Code:
new Float:fRatio = ( floatget_user_fragsid ) ) / floatget_user_deathsid ) ) );
if ( 
fRatio >= 1.5 
{
        

__________________
Bugsy is offline
Santaaa
BANNED
Join Date: May 2012
Old 07-09-2012 , 21:19   Re: Calculating, k/d ratio.
Reply With Quote #10

Yea, I used a FLOAT for my calculation, but I didnt know that it will catch the ratio's number like on this way
Santaaa is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:17.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode