Raised This Month: $ Target: $400
 0% 

Setting team bug


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 09-04-2009 , 11:02   Setting team bug
Reply With Quote #1

I'm just confused in those codes, I don't understand why sometimes terrorist got respawned in ct respawn zone .. ?
( This plugin switches teams when terrorist killed ct, and in ct team max 4 ct players. )
Btw if someone can,then please recode this code.
PHP Code:
// Global
#define MAX_CTS 4

new bool:g_bSwitch33 ];

// In plugin_init
register_messageget_user_msgid"TeamInfo" ), "msg_TeamInfo" );
register_logevent("logevent_round_end"2"1=Round_End");
register_event("DeathMsg""event_deathmsg""a")

//Round end event
public logevent_round_end()
{
    static 
iCsTeams:team;
    for( 
<= g_iMaxPlayers i++ )
    {
        if( !
is_user_connected) || !g_bSwitch]
        || !( 
CS_TEAM_UNASSIGNED < ( team cs_get_user_team) ) < CS_TEAM_SPECTATOR ) )
            continue;
            
        
cs_set_user_teami, ( team CS_TEAM_CT ) + CS_TEAM_T );
        
g_bSwitch] = false;
    }
}

// Team info message
public msg_TeamInfo(msgiddestreceiverid)
{
    if( 
dest != MSG_ALL && dest != MSG_BROADCAST ) return;
        
    new 
teamname[3];
    
get_msg_arg_string(2teamnamesizeof(teamname) - 1);
        
    new 
FmTeams:team;
    for( new 
FmTeams:FM_TEAM_UNASSIGNEDFmTeamsi++ )
    {
        if( 
g_TeamInfo[i][0] == teamname[0] )
        {
            
team i;
            break;
        }
    }
        
    new 
client get_msg_arg_int(1);
    if( 
team == FM_TEAM_CT && fm_get_user_team(client) == team )
    {
        new 
ctnum;
        for( new 
1<= g_iMaxPlayersi++ )
        {
            if( 
!= client
            
&& is_user_connected(i)
            && 
fm_get_user_team(i) == FM_TEAM_CT
            
&& ++ctnum == MAX_CTS )
            {
                
set_pdata_int(client114_:FM_TEAM_T);
                
set_msg_arg_string(2g_TeamInfo[FM_TEAM_T]);
                break;
            }
        }
    }
    
    if( 
g_bSwitchid ] )
    {
        
g_bSwitch[id] = false;
    }
}

// DeathMsg
public event_deathmsg()
{
    new 
i_victim read_data(2)
    new 
i_attacker read_data(1)
    if ( !(
<= i_victim <= g_iMaxPlayers) )
        return;
    
    if( 
cs_get_user_teami_attacker ) == CS_TEAM_T && cs_get_user_teami_victim ) == CS_TEAM_CT )
    {
        if( !
g_bSwitchi_attacker ] )
        {
            
g_bSwitchi_attacker ] = true;
                
            if( !
g_bSwitchi_victim ] )
            {
                
g_bSwitchi_victim ] = true;
            }
        }
    }

__________________

Last edited by xbatista; 09-04-2009 at 11:08.
xbatista is offline
Send a message via Skype™ to xbatista
 


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 15:08.


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