Raised This Month: $12 Target: $400
 3% 

Solved [New ] GetAlive CT and T By : marcelowzd


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
FonixPro20
Member
Join Date: Mar 2018
Old 03-23-2018 , 22:24   [New ] GetAlive CT and T By : marcelowzd
Reply With Quote #1

Hi,

Thanks To marcelowzd

Have Fun ,

PHP Code:
public fnGetAliveszTeam[ ] ) // szTeam CAN BE "CT" or "TERRORIST"
{
    new 
iPlayers32 ], iNumiCount;

    
//get_players_ex( iPlayers, iNum, GetPlayers_ExcludeDead | GetPlayers_MatchTeam, szTeam ); // AMXX 1.8.3
    
get_playersiPlayersiNum"ae"szTeam ); // AMXX 1.8.2

    
for( new 0iNumi++ )
        
iCount++;

    return 
iCount;
}

public 
fnGetAliveiTeam // Without CSTRIKE -> iTeam can be 0 = UNASSIGNED - 1 = TERRORIST 2 - CT 3 - SPECTATOR
{
    new 
iMax get_maxplayers( );
    new 
iCount 0;

    for( new 
iClient 1iClient iMaxiClient++ )
        if( 
is_user_aliveiClient ) )
            if( 
get_user_teamiClient ) == iTeam )
                
iCount++;

    return 
iCount;
}

public 
fnGetAliveCsTeams:csTeam // csTeam can be CS_TEAM_CT, CS_TEAM_T, CS_TEAM_UNASSIGNED, CS_TEAM_SPECTATOR
{
    new 
iMax get_maxplayers( );
    new 
iCount 0;

    for( new 
iClient 1iClient iMaxiClient++ )
        if( 
is_user_aliveiClient ) )
            if( 
cs_get_user_teamiClient ) == csTeam )
                
iCount++;

    return 
iCount;


Last edited by FonixPro20; 03-24-2018 at 01:44.
FonixPro20 is offline
marcelowzd
Senior Member
Join Date: Feb 2011
Location: São Paulo, Brazil
Old 03-24-2018 , 00:19   Re: [HELP] Alive CT and T Help For Fix
Reply With Quote #2

Code:
public fnGetAlive( szTeam[ ] ) // szTeam CAN BE "CT" or "TERRORIST"
{
    new iPlayers[ 32 ], iNum, iCount;

    //get_players_ex( iPlayers, iNum, GetPlayers_ExcludeDead | GetPlayers_MatchTeam, szTeam ); // AMXX 1.8.3
    get_players( iPlayers, iNum, "ae", szTeam ); // AMXX 1.8.2

    return iNum;
}

public fnGetAlive( iTeam ) // Without CSTRIKE -> iTeam can be 0 = UNASSIGNED - 1 = TERRORIST 2 - CT 3 - SPECTATOR
{
    new iMax = get_maxplayers( );
    new iCount = 0;

    for( new iClient = 1; iClient < iMax; iClient++ )
        if( is_user_alive( iClient ) )
            if( get_user_team( iClient ) == iTeam )
                iCount++;

    return iCount;
}

public fnGetAlive( CsTeams:csTeam ) // csTeam can be CS_TEAM_CT, CS_TEAM_T, CS_TEAM_UNASSIGNED, CS_TEAM_SPECTATOR
{
    new iMax = get_maxplayers( );
    new iCount = 0;

    for( new iClient = 1; iClient < iMax; iClient++ )
        if( is_user_alive( iClient ) )
            if( cs_get_user_team( iClient ) == csTeam )
                iCount++;

    return iCount;
}
You can use any of them, the first one is better.
Usage
First -> fnGetAlive( "TERRORIST" ) or fnGetAlive( "CT" );
Second -> fnGetAlive( 1 ) or fnGetAlive( 2 );
Third ->fnGetAlive( CS_TEAM_CT ) or fnGetAlive( CS_TEAM_T );

Last edited by marcelowzd; 03-28-2018 at 20:26. Reason: First method now counting right
marcelowzd is offline
FonixPro20
Member
Join Date: Mar 2018
Old 03-24-2018 , 01:22   Re: [HELP] Alive CT and T Help For Fix
Reply With Quote #3

Thanks Bro I will use This One TY

And Thank Youuuuuuuuuuuu Broooo

PHP Code:
public fnGetAliveCsTeams:csTeam // csTeam can be CS_TEAM_CT, CS_TEAM_T, CS_TEAM_UNASSIGNED, CS_TEAM_SPECTATOR
{
    new 
iMax get_maxplayers( );
    new 
iCount 0;

    for( new 
iClient 1iClient iMaxiClient++ )
        if( 
is_user_alive(  iClient ) )
            if( 
cs_get_user_team(  iClient ) == csTeam )
                
iCount++;

    return 
iCount;


Last edited by FonixPro20; 03-24-2018 at 01:46.
FonixPro20 is offline
marcelowzd
Senior Member
Join Date: Feb 2011
Location: São Paulo, Brazil
Old 03-24-2018 , 01:28   Re: [HELP] Alive CT and T Help For Fix
Reply With Quote #4

PHP Code:
public fnGetAliveCsTeams:csTeam // csTeam can be CS_TEAM_CT, CS_TEAM_T, CS_TEAM_UNASSIGNED, CS_TEAM_SPECTATOR
{
    new 
iMax get_maxplayers( );
    new 
iCount 0;

    for( new 
iClient 1iClient iMaxiClient++ )
        if( 
is_user_alive(  iClient ) )
            if( 
cs_get_user_team(  iClient ) == csTeam )
                
iCount++;

    return 
iCount;

Didn't see that, edited first post.
marcelowzd is offline
Old 03-24-2018, 01:40
FonixPro20
This message has been deleted by FonixPro20.
Old 03-24-2018, 02:21
FonixPro20
This message has been deleted by FonixPro20.
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 03-24-2018 , 05:25   Re: [New ] GetAlive CT and T By : marcelowzd
Reply With Quote #5

Do not make threads into some sort of nonsense. Keep your original post unedited unless it needs some better explanation/grammar correction.
__________________
retired chump
DjSoftero is offline
Reply


Thread Tools
Display Modes

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 09:12.


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