Raised This Month: $ Target: $400
 0% 

Team join actions...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CS-A-Roland
Member
Join Date: Jul 2009
Old 07-15-2012 , 09:02   Team join actions...
Reply With Quote #1

Hey there... got a problem with understanding of team join action!

If i do this:
Code:
case 0: // Join NC (Terrorists)
            {    
                client_print( id, print_chat, "%s You cannot join the Night-Crawler team!", g_szPrefix );
                
                return PLUGIN_HANDLED;
            }
to this here:
Code:
case 0: // Join NC (Terrorists)
            {    
                client_print( id, print_chat, "%s You cannot join the Night-Crawler team!", g_szPrefix );
                
                set_task( 0.1, "task_JoinTeam", id );
                
                return PLUGIN_HANDLED;
            }
with these task_JoinTeam:
Code:
    public task_JoinTeam( id )
    {
    cs_set_user_team( id, CS_TEAM_CT );
    }
Is it ok, or should i beware of any kind of problems with this code?!
By the way, i need it also for the "Auto Team" function, but these class isn't addet at this time, my question: Is it case 4 or case 5?!
Case 5 didnt work with this function i loose identation...

Thanks for any kind of response!

Didn't work realy... at the scoreboard im in the CT Team but at the Game itself ive to wait for the roundend and then i fall down at the camera spots of spectator! What is this?! I tought if i use this i will put into the ct team and ... damn -.-'
__________________
oOOOoooh it's www.Cs-Attack.de
New World of Warcraft Mod Beta 0.5(based on WC3FT 3.5)
Counterstrike 1.6 SERVER:
Server IP: 193.192.58.154:27200

CONDITION ZERO SERVER:
Server IP: 193.192.58.154:27016

Last edited by CS-A-Roland; 07-15-2012 at 09:44.
CS-A-Roland is offline
Santaaa
BANNED
Join Date: May 2012
Old 07-15-2012 , 10:18   Re: Team join actions...
Reply With Quote #2

Why do you start at case 0?
Try starting at case 1.
Santaaa is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 07-15-2012 , 10:21   Re: Team join actions...
Reply With Quote #3

show the whole code. Specifically the function in which the switch statement is in. and the task.

EDIT: also note the team constants. These are consistent with get_user_team even if not called from the cstrike module

Code:
//Team Constants: 
enum CsTeams {
	CS_TEAM_UNASSIGNED = 0,
	CS_TEAM_T = 1,
	CS_TEAM_CT = 2,
	CS_TEAM_SPECTATOR = 3
};
So i'd use 0 (unassigned) as the atuo-join function, then start at 1
__________________
What an elegant solution to a problem that doesn't need solving....

Last edited by Liverwiz; 07-15-2012 at 10:24.
Liverwiz is offline
CS-A-Roland
Member
Join Date: Jul 2009
Old 07-15-2012 , 10:31   Re: Team join actions...
Reply With Quote #4

I think the reason ist that the creator of this plugin don't want to set the teamjoin at 1... when you chosen the TerrorTeam...



Code:
    public TeamSelectMenu_Handler( id, iKey )
    {
        new CsTeams:iTeam = cs_get_user_team( id );
        
        CountTeams();

        switch( iKey )
        {
            case 0: // Join NC (Terrorists)
            {    
                client_print( id, print_chat, "%s You cannot join the Night-Crawler team!", g_szPrefix );
                
                set_task( 0.1, "task_JoinTeam", id );
                
                return PLUGIN_HANDLED;
            }
            
            case 1: // Join Humans (CTs)
            {
                if( iTeam == TEAM_HUMAN )
                    return PLUGIN_HANDLED;
                
                if( task_exists( TASK_STARTGAME ) )
                    ForceTeam( id, TEAM_HUMAN );
                
                else
                {
                    CountTeams();
                    
                    // ( Percent * Total Players / 100 ) - Current Amount of NCs
                    new iNeeded = get_pcvar_num( g_pNightcrawlerRatio ) * ( g_iTeamCount[ TEAM_NC ] + g_iTeamCount[ TEAM_HUMAN ] ) / 100 - g_iTeamCount[ TEAM_NC ];
                    
                    if( iNeeded == 0 && g_iTeamCount[ TEAM_HUMAN ] == 1 )
                        iNeeded = 1;
                        
                    if( iNeeded >= 1 )
                        ForceTeam( id, TEAM_NC );
                    
                    else ForceTeam( id, TEAM_HUMAN );
                
                }
                
                return PLUGIN_HANDLED;
            }
            
            case 5:
            {
                user_silentkill( id );
                ForceTeam( id, CS_TEAM_SPECTATOR );
                
                return PLUGIN_HANDLED;
            }
        }
        
        return PLUGIN_HANDLED;
    }
    
    public task_JoinTeam( id )
    {
    cs_set_user_team( id, CS_TEAM_CT );
    }

    public ForceTeam( id, CsTeams:iTeam )
    {
        static iRestore, iVGUI, iMSGBlock;

        iRestore = get_pdata_int( id, m_iVGUI );
        iVGUI = iRestore & ( 1 << 0 );
        if( iVGUI )
            set_pdata_int( id, m_iVGUI, iRestore & ~( 1 << 0 ) );

        switch( iTeam )
        {
            case CS_TEAM_SPECTATOR:
            {
                iMSGBlock = get_msg_block( g_msgShowMenu );
                set_msg_block( g_msgShowMenu, BLOCK_ONCE );
                dllfunc( DLLFunc_ClientPutInServer, id );
                set_msg_block( g_msgShowMenu, iMSGBlock );
                set_pdata_int( id, m_fGameHUDInitialized, 1 );
                engclient_cmd( id, "jointeam", "6" );
            }
            case CS_TEAM_T, CS_TEAM_CT:
            {
                iMSGBlock = get_msg_block( g_msgShowMenu );
                set_msg_block( g_msgShowMenu, BLOCK_ONCE );
                engclient_cmd( id, "jointeam", ( iTeam == CS_TEAM_CT ) ? "2" : "1" );
                engclient_cmd( id, "joinclass", "1" );
                set_msg_block( g_msgShowMenu, iMSGBlock );
            }
        }
        
        if( iVGUI )
            set_pdata_int( id, m_iVGUI, iRestore );
    }
This is the part for teamjoin and teamforce, the teamforce works fine "IF" the players go into the CT team... but they dont do it! If they dont know that they "must" go into ct they usw auto or terrorist...
So i think the creator thougt mhm block the team with a 0 and so its ever false, but its buggy becase if you use the terrorist team you have to reconnect and go to ct first then the gameplay starts! If you dont reconnect and just go to CT you just came into the game and nothing else happens...

@ Liverwiz
Nothing like this what you add, just this here:

Code:
        #define TEAM_MENU                    "#Team_Select"
        #define TEAM_MENU2                    "#Team_Select_Spect"

        #define TEAM_NC         CS_TEAM_T
        #define TEAM_HUMAN         CS_TEAM_CT
//then later....

        new g_iTeamCount[ CsTeams ];    

// then later

        register_clcmd( "jointeam",     "CmdJoinTeam"     );
        register_clcmd( "joinclass",     "CmdJoinTeam"     );

// then this...

        register_menucmd( register_menuid( "Team_Select", 1 ), MENU_KEY_1 | MENU_KEY_2 | MENU_KEY_5 | MENU_KEY_6,       "TeamSelectMenu_Handler" );
Thats it, not more...

I also know in another plugin like this, the payers connect and dont get any menu, they just join the ct team automatic, there is no menu available. But i need the menu to give the player the chance to go spec when there is a cheater online to record and also report him to us!

To set it to "case 1" don't work, it brokes the team join action, if it set to 1 you can just join spectator nothing else...
Ive tried to fix it in the CountTeams function too, but nothing happens than before where i set "case 0" to "case 1"
__________________
oOOOoooh it's www.Cs-Attack.de
New World of Warcraft Mod Beta 0.5(based on WC3FT 3.5)
Counterstrike 1.6 SERVER:
Server IP: 193.192.58.154:27200

CONDITION ZERO SERVER:
Server IP: 193.192.58.154:27016

Last edited by CS-A-Roland; 07-15-2012 at 12:40.
CS-A-Roland 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 15:10.


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