Raised This Month: $ Target: $400
 0% 

get team players


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Debesėlis
Senior Member
Join Date: Aug 2008
Location: Lithuania
Old 10-25-2013 , 10:40   Re: get team players
Reply With Quote #1

PHP Code:
#include < amxmodx >
#include < fakemeta >
#pragma semicolon 1

const m_iNumSpawns 365;
new 
bool:g_bIsFreezeTime true;

public 
plugin_init ( )
{
    
register_plugin"No Spawn After FreezeTime""0.0.1""ConnorMcLeod" );
    
register_event"HLTV""Event_HLTV_New_Round""a""1=0""2=0" );
    
register_logevent"LogEvent_Round_Start"2"1=Round_Start" );
}

public 
Event_HLTV_New_Round ( )
    
g_bIsFreezeTime true;

public 
LogEvent_Round_Start ( )
{
    
g_bIsFreezeTime false;
    
    new 
players32 ], num;
    
get_playersplayersnum"h" );
    for ( --
numnum >= 0num-- )
    {
        
set_pdata_intplayersnum ], m_iNumSpawns);
    }
}

public 
client_putinserver id )
{
    new 
iTEcountiCTcount;
    for ( new 
iPlayer 1iPlayer <= 32iPlayer++ )
    {
        if ( 
is_user_connectediPlayer ) )
        {
            switch ( 
cs_get_user_teamiPlayer ) )
            {
                case 
CS_TEAM_TiTEcount++
                case 
CS_TEAM_CTiCTcount++
            }
        }
    }
    
    if ( 
iTEcount >= && iCTcount >= )
    {
        if ( !
g_bIsFreezeTime && !is_user_botid ) && !is_user_hltvid ) )
            
set_pdata_intidm_iNumSpawns);
    }

Debesėlis is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 10-25-2013 , 12:49   Re: get team players
Reply With Quote #2

Don't use #2 code
get_players is always better than looping from 1 to 32, or than from 1 to maxplayers.

PHP Code:
public client_putinserver id )
{
    if( !
g_bIsFreezeTime && !is_user_botid ) && !is_user_hltvid ) )
    {
        new 
iTEcountiCTcountplayers[32];
        
get_players(playersiTEcount"e""TERRORIST");
        
get_players(playersiCTcount"e""CT");
    
        if ( 
iTEcount >= && iCTcount >= )
        {
                
set_pdata_intidm_iNumSpawns);
        }
    }

__________________
- tired and retired -

- my plugins -
ConnorMcLeod 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 23:22.


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