Raised This Month: $12 Target: $400
 3% 

Help with floats?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ILUSION
Senior Member
Join Date: Oct 2006
Location: Argentina
Old 01-01-2010 , 14:03   Help with floats?
Reply With Quote #1

Hi I need a little help with my code... I want transfer a player to terrorist team when there're 1 ct each 4 tts.

I try make this with averages but I fail because I can't set correctly the float.

PHP Code:
public eTeamInfo()
{
    if (!
get_pcvar_num(pcvar[0]))
        return 
0
        
    
new id read_data(1)
    
    new 
countTcountCT
        
    
for (new 0get_maxplayers(); i++)
    {
        if (
get_user_team(i) == 1)
            
countT++
        
        if (
get_user_team(i) == 2)
            
countCT++
    }
    
    new 
Float:average = (countT countCT) / 4
    
    
if (average 1.5)
        
cs_set_user_team(idCS_TEAM_T)
    
    return 
0

Thanks, and happy new year

Last edited by ILUSION; 01-01-2010 at 14:19.
ILUSION is offline
wyrda
Member
Join Date: Nov 2009
Old 01-01-2010 , 15:18   Re: Help with floats?
Reply With Quote #2

I think that you should divide with 4.0 .
__________________
wyrda is offline
ILUSION
Senior Member
Join Date: Oct 2006
Location: Argentina
Old 01-02-2010 , 02:55   Re: Help with floats?
Reply With Quote #3

Quote:
Originally Posted by wyrda View Post
I think that you should divide with 4.0 .
OMG thanks you!
ILUSION 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 14:51.


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