Raised This Month: $ Target: $400
 0% 

Two get_user_msgid("TeamInfo")


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 01-04-2009 , 12:59   Two get_user_msgid("TeamInfo")
Reply With Quote #1

OK I have this.
In plugin init.

PHP Code:
new g_maxplayers
new p_On
new bool:g_bSwitch33 
PHP Code:
register_message(get_user_msgid("TeamInfo"), "message_teaminfo")

        
p_On register_cvar"amx_stbk""1" // 1 = switching teams.
        
g_maxplayers get_maxplayers()
        
register_event"HLTV""ev_newRound""a""1=0""2=0" )
        
register_event"DeathMsg""ev_Death""a" )
        
register_messageget_user_msgid"TeamInfo" ), "msg_TeamInfo" )

///Here is the in the ct team can be max 4 ct's///
public message_teaminfo(msg_idmsg_dest){
     if (
msg_dest != MSG_ALL && msg_dest != MSG_BROADCAST) return;
     new 
id get_msg_arg_int(1)
     static 
team[2]
     
get_msg_arg_string(2teamsizeof team 1)
     if(
team[0] == 'U' || team[0] == 'S') return;
     new 
cts ckrun_get_ct_num()
     if(
cts >= 4){
     
cs_set_user_team(idCS_TEAM_TCS_DONTCHANGE)
     
set_msg_arg_string(2"TERRORIST")
     }
}
stock ckrun_get_ct_num(){
      new 
num i
      
for (1<= g_maxplayersi++){
      if (
is_user_connected(i) && get_user_team(i) == 2)
      
num ++
      }
      return 
num
}
///Switching teams, If terrorist killed ct switch their teams///
public client_disconnect(id)
{
       
g_bSwitchid ] = false
}
public 
ev_Death()
{
    if( !
get_pcvar_nump_On ) )
    {
        return 
PLUGIN_CONTINUE;
    }
    
    static 
iAtt iAtt read_data);
    if( !( 
<= iAtt <= g_maxplayers ) )
    {
        return 
PLUGIN_CONTINUE;
    }
    
    static 
iVic iVic read_data);
    if( !( 
<= iVic <= g_maxplayers ) )
    {
        return 
PLUGIN_CONTINUE;
    }
    
    if( 
cs_get_user_teamiAtt ) == CS_TEAM_T && cs_get_user_teamiVic ) == CS_TEAM_CT )
    {
        if( !
g_bSwitchiAtt ] )
        {
            
g_bSwitchiAtt ] = true;
            
            if( !
g_bSwitchiVic ] )
            {
                
g_bSwitchiVic ] = true;
            }
        }
    }
    
    return 
PLUGIN_CONTINUE;
}
public 
msg_TeamInfomidDestid )
{
    if( 
Dest != MSG_ALL && Dest != MSG_BROADCAST )
    {
        return 
PLUGIN_CONTINUE;
    }
    
    if( !
get_pcvar_nump_On ) )
    {
        return 
PLUGIN_CONTINUE;
    }
    
    if( 
g_bSwitchid ] )
    {
        
g_bSwitchid ] = false;
    }
    
    return 
PLUGIN_CONTINUE;
}
public 
ev_newRound()
{
    if( !
get_pcvar_nump_On ) )
    {
        return;
    }
    
    static 
iCsTeams:team;
    for( 
<= g_maxplayers 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;
    }

This is good if I'm using 2 Team info?
And this codes together worst working,maybe someone can configure it?

Last edited by xbatista; 01-04-2009 at 13:02.
xbatista is offline
Send a message via Skype™ to xbatista
 



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:11.


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