Raised This Month: $ Target: $400
 0% 

Split team


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CarbonDioxide
Member
Join Date: Apr 2012
Old 06-15-2012 , 06:15   Split team
Reply With Quote #1

Hello all, I am trying to do the following:

I want to get the number of the players in the terrorist team, and then "split" them to two teams by setting bits.

For example:
PHP Code:
public splitThem()    
{
    new 
players[32], numplayer;
    
get_playersplayersnum"a" );
    
    for( new 
0numi++ )
    {
        
player players[i];
            
        
//For half the terrorists: 
        
set_bit(team1player);
        
//For the other half
        
set_bit(team1player);
    }

Do you know any way to do that ?
Thank you in advance
CarbonDioxide is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 06-15-2012 , 10:33   Re: Split team
Reply With Quote #2

Divide the players by 2.
make 2 new variables and set 1 half as players1 and the other as players2.
then make again 2 new variables: team1 and team2.

set_bit(team1, players1)
set_bit(team2, players2)

Don't even know if that would work what you're doing but you could try.
also, print a message to check if it works.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-15-2012 , 10:45   Re: Split team
Reply With Quote #3

PHP Code:
public splitThem()    
{
    new 
players[32], numplayer;
    
get_playersplayersnum"a" );
    
    for( new 
0numi++ )
    {
        
player players[i];
        
        if( !( 
) )
            
// Set to Terrorist
        
else
            
// Set to CT
    
}

__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
CarbonDioxide
Member
Join Date: Apr 2012
Old 06-17-2012 , 13:36   Re: Split team
Reply With Quote #4

Allright, so, what I am trying to do is make half the terrorists glow red, and the another half of the terrorists glow blue.

I tried this:
PHP Code:
public splitThem()      
{  
    new 
players[32], numplayer;  
    
get_playersplayersnum"a" );  
      
    for( new 
0numi++ )  
    {  
        
player players[i];  
          
        if( !( 
) )                      
            
set_user_rendering(player,kRenderFxGlowShell,0,0,255,kRenderNormal,16); 
        else  
            
set_user_rendering(player,kRenderFxGlowShell,255,0,0,kRenderNormal,16); 
    }  

But, nothing.. What am I doing wrong ?
CarbonDioxide is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-17-2012 , 15:41   Re: Split team
Reply With Quote #5

The only problem I see is that you are selecting all alive players, not just alive Terrorists.

Here's how to add team filter to get_players():
Code:
get_players( players, num, "ae", "TERRORIST" );

Other than that, your code is fine.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
CarbonDioxide
Member
Join Date: Apr 2012
Old 06-18-2012 , 09:38   Re: Split team
Reply With Quote #6

Still, it just won't work, and I just don't get why !
I am a CT and I have two Ts in front of me. I type the command. Then a message is printed to confirm the function was executed, but none of the Ts is glowing..
CarbonDioxide is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-18-2012 , 10:24   Re: Split team
Reply With Quote #7

Do you have semiclip or some other plugin running that changes their rendering?
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
CarbonDioxide
Member
Join Date: Apr 2012
Old 06-18-2012 , 10:36   Re: Split team
Reply With Quote #8

Well, in the same plugin sometimes another glow is added, but never at the same time I am executing this function. Also, all the other renderings added are resetted at the round start ..


edit: Allright, I fixed it after all. Thank you for the code

Last edited by CarbonDioxide; 06-18-2012 at 15:31.
CarbonDioxide is offline
CarbonDioxide
Member
Join Date: Apr 2012
Old 06-19-2012 , 11:52   Re: Split team
Reply With Quote #9

Sorry for double posting.
Even though I thought it was fixed, after trying it with two players, I noted that they both had the sae glow, so they actually where not split, but they just got both the same glow.

Is there maybe another way of doing this ?
Thank you for all the help
CarbonDioxide is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-19-2012 , 12:03   Re: Split team
Reply With Quote #10

Show your code.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 06:19.


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