Raised This Month: $ Target: $400
 0% 

[SOLVED]gain problem with random player ;)


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 10-23-2009 , 10:44   Re: again problem with random player ;)
Reply With Quote #2

try this:
PHP Code:
public round_end()
{
    new 
alive_Ts[33], Ts[33], alive_CTs[33], CTs[33]
    new 
alive_Ts_numTs_numalive_CTs_numCTs_numid
    
for(new 1<= g_MaxPlayersi++){
        if(!
is_user_connected(i))
            continue
        switch(
cs_get_user_team(i)){
            case 
CS_TEAM_CT:{
                
CTs[CTs_num++] = i
                
if(is_user_alive(i))
                    
alive_CTs[alive_CTs_num++] = i
            
}
            case 
CS_TEAM_T:{
                
Ts[Ts_num++] = i
                
if(is_user_alive(i))
                    
alive_Ts[alive_Ts_num++] = i
            
}
        }
    }

    if(
CTs_num Ts_num 2)
        return  
// not enough players
    
    
if(alive_Ts_num 0)
        
cs_set_user_team(alive_Ts[random(alive_Ts_num)], CS_TEAM_CT)
    else if(
alive_CTs_num 0)
        
id alive_CTs[random(alive_CTs_num)]
    else if(
Ts_num 0)
        
cs_set_user_team(Ts[random(Ts_num)], CS_TEAM_CT)
    else if(
CTs_num 0)
        
id CTs[random(CTs_num)]

    for(new 
i=0i<CTs_numi++)
        if(
CTs[i] != id)
            
cs_set_user_team(CTs[i], CS_TEAM_T)

__________________
Impossible is Nothing

Last edited by Sylwester; 10-23-2009 at 10:47.
Sylwester is offline
 



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 17:34.


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