Raised This Month: $ Target: $400
 0% 

Stuck at cs_set_user_team


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Diegorkable
Veteran Member
Join Date: Jun 2011
Old 07-24-2011 , 08:32   Re: Stuck at cs_set_user_team
Reply With Quote #1

PHP Code:
public MoveFromSpec(id)
{
    new 
players[32], pnumtempid;  
    new 
tteamctteam
      
    get_players
(playerspnum"ch"); 
        
    for( new 
ii<pnumi++ )  
    {  
        
tempid players[i];  
        if (
cs_get_user_team(tempid) == CS_TEAM_T
        { 
            
tteam++
        }
        
        else if(
cs_get_user_team(tempid) == CS_TEAM_CT)
        {
            
ctteam++
        }
    } 
    
    if (
tteam ctteam)
    {
        
cs_set_user_team(idCS_TEAM_CT)
    }
    
    else if (
ctteam >= tteam)
    {
        
cs_set_user_team(idCS_TEAM_T)
    }

AT the last lines of the code it sets his team to the team that has less teammates. and he's being moved FROM spectator to the selected team
Diegorkable is offline
Honors
Member
Join Date: Jul 2011
Old 07-24-2011 , 08:51   Re: Stuck at cs_set_user_team
Reply With Quote #2

Code:
new players[ 32 ] , numT , numCt get_players( players , numT , "he" , "TERRORIST" ) get_players( players , numCt , "he" , "CT" ) if( numT > numCt ) {      cs_set_user_team( id , CS_TEAM_CT ) } else {      cs_set_user_team( id , CS_TEAM_T ) }

That should work.

Last edited by Honors; 07-24-2011 at 11:04.
Honors is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-24-2011 , 09:34   Re: Stuck at cs_set_user_team
Reply With Quote #3

Untested. There have been reports of get_players not returning data properly with particular combinations of flags. If you run into problems with this method then that may be the case. Let me know if you have problems.
PHP Code:
public MoveFromSpec(id)
{
    new 
players[32], tteamctteam;
      
    
get_players(playerstteam"che" "TERRORIST" ); 
    
get_players(playersctteam "che" "CT" );

    
cs_set_user_teamid , ( ctteam >= tteam ) ? CS_TEAM_T CS_TEAM_CT );

__________________
Bugsy 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 01:06.


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