Raised This Month: $ Target: $400
 0% 

Proper way of getting ratio of teams?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
VMAN
Senior Member
Join Date: Oct 2007
Location: California, US
Old 08-15-2009 , 21:03   Proper way of getting ratio of teams?
Reply With Quote #1

I have the number of players on ct and t in their own variables.

Basically, I want to check if the ratio of CT to T is 1:2.

I tried dividing amount of T's by amount of CT's, but that didn't seem to work.
VMAN is offline
Jon
Veteran Member
Join Date: Dec 2007
Old 08-15-2009 , 22:01   Re: Proper way of getting ratio of teams?
Reply With Quote #2

You are running that jailbreak server? Isn't the ratio on such a server like 1 or even 1:4?
Jon is offline
VMAN
Senior Member
Join Date: Oct 2007
Location: California, US
Old 08-16-2009 , 01:34   Re: Proper way of getting ratio of teams?
Reply With Quote #3

On my server I do no more than 1:2
VMAN is offline
VMAN
Senior Member
Join Date: Oct 2007
Location: California, US
Old 08-17-2009 , 22:42   Re: Proper way of getting ratio of teams?
Reply With Quote #4

Anyone got a clue what I'm doing wrong?

Here's a better example of how I'm attempting to do it:

PHP Code:
    if(ct != 0) {
        if(
t/ct >= 2) {
            
dosomething();
        }
    } 
My function is not called
VMAN is offline
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 08-17-2009 , 22:54   Re: Proper way of getting ratio of teams?
Reply With Quote #5

Try using 2.0 instead of 2. And also is it possible that you aren't setting your t and ct variables right?

Code:
  new t_count, ct_count, Players[32],pnum; get_players( Players, pnum , "a" ); //only alive players for( new i =0; i < pnum; i++ ) {     switch( get_user_team( Players[i] ) )     {          case 1: {t_count++;}          case 2: {ct_count++;}     } }
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 08-17-2009 , 23:11   Re: Proper way of getting ratio of teams?
Reply With Quote #6

Based on the code above:

PHP Code:
    new playersCount[3Players[32],pnum;
    
    
get_playersPlayerspnum "a" ); //only alive players
    
for( new =0pnumi++ )
    {
        
playersCount[get_user_team(Players[i])]++
    }
    
    new 
Float:ratio playersCount[1] / (playersCount[1]+playersCount[2]) 
Edit:
in the code above i'm calculating the ratio of T players per alive players. What makes that if there are 5 T's and 10 Ct's it will give 0.3(3). But, you just want the ratio of T's per Ct's so the way you doing is correct

PHP Code:
  new Float:ratio playersCount[1] / playersCount[2
It would give 0.5
__________________

Last edited by joaquimandrade; 08-17-2009 at 23:19.
joaquimandrade is offline
VMAN
Senior Member
Join Date: Oct 2007
Location: California, US
Old 08-18-2009 , 15:38   Re: Proper way of getting ratio of teams?
Reply With Quote #7

Thank you
VMAN is offline
VMAN
Senior Member
Join Date: Oct 2007
Location: California, US
Old 08-18-2009 , 19:59   Re: Proper way of getting ratio of teams?
Reply With Quote #8

When I compile I get one warning on this line

PHP Code:
new Float:ratio ct
Tag mismatch
VMAN is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-18-2009 , 20:17   Re: Proper way of getting ratio of teams?
Reply With Quote #9

PHP Code:
new Float:ratio float) / floatct ); 
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
VMAN
Senior Member
Join Date: Oct 2007
Location: California, US
Old 08-18-2009 , 20:22   Re: Proper way of getting ratio of teams?
Reply With Quote #10

Thank you
VMAN is offline
Reply



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:08.


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