AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Split team (https://forums.alliedmods.net/showthread.php?t=187582)

CarbonDioxide 06-15-2012 06:15

Split team
 
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 :)

Napoleon_be 06-15-2012 10:33

Re: Split team
 
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.

Exolent[jNr] 06-15-2012 10:45

Re: Split team
 
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
    
}



CarbonDioxide 06-17-2012 13:36

Re: Split team
 
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 ?

Exolent[jNr] 06-17-2012 15:41

Re: Split team
 
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.

CarbonDioxide 06-18-2012 09:38

Re: Split team
 
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..

Exolent[jNr] 06-18-2012 10:24

Re: Split team
 
Do you have semiclip or some other plugin running that changes their rendering?

CarbonDioxide 06-18-2012 10:36

Re: Split team
 
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 :)

CarbonDioxide 06-19-2012 11:52

Re: Split team
 
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 :)

Exolent[jNr] 06-19-2012 12:03

Re: Split team
 
Show your code.


All times are GMT -4. The time now is 06:19.

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