AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with floats? (https://forums.alliedmods.net/showthread.php?t=114042)

ILUSION 01-01-2010 14:03

Help with floats?
 
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

wyrda 01-01-2010 15:18

Re: Help with floats?
 
I think that you should divide with 4.0 .

ILUSION 01-02-2010 02:55

Re: Help with floats?
 
Quote:

Originally Posted by wyrda (Post 1039253)
I think that you should divide with 4.0 .

OMG thanks you!


All times are GMT -4. The time now is 04:12.

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