Raised This Month: $ Target: $400
 0% 

Check CT Reconnect


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Snitch
Veteran Member
Join Date: Sep 2013
Location: Kazakhstan
Old 10-19-2014 , 14:27   Check CT Reconnect
Reply With Quote #1

Code:
/* Plugin generated by AMXX-Studio */

#include < amxmodx >
#include < fakemeta >

enum _: FmTeams
{
    FM_TEAM_UNASSIGNED,
    FM_TEAM_T,
    FM_TEAM_CT,
    FM_TEAM_SPEC
}

new g_pTeam, g_iMaxPlayers;

public plugin_init( ) 
{
    register_plugin( "Teams Balancer", "v1.0", "+ColdWar" )
    
    g_pTeam = get_cvar_pointer( "humans_join_team" );
    
    g_iMaxPlayers = get_maxplayers( ) ;
}

public client_putinserver( client )
{
    static g_iTeams[ FmTeams ];
    
    for( new i = 0 ; i < FmTeams ; i ++ )
        g_iTeams[ i ] = 0;
        
    for( new i = 1 ; i <= g_iMaxPlayers ; i ++ )
    {
        if( !is_user_connected( i ) )
            continue;
        
        g_iTeams[ FM_GetUserTeam( i ) ] ++;
    }
    
    set_pcvar_string( g_pTeam, GetTeam( g_iTeams ) );
}

stock GetTeam( g_iTeams[ FmTeams ] )
{
    new szBuffer[ 4 ] = "any";

    if( g_iTeams[ FM_TEAM_CT ] < g_iTeams[ FM_TEAM_T ] )
        szBuffer = "ct"
    else if( g_iTeams[ FM_TEAM_CT ] > g_iTeams[ FM_TEAM_T ] )
        szBuffer = "t"
    
    return szBuffer;
}

stock FM_GetUserTeam( client )
    return get_pdata_int( client, 114 );
Can anyone add to this code, check if someone were was CT team and did ​​Reconnect then re-entered again to CT team will automatic moved to terrorist?

Sorry for my English
Snitch is offline
Send a message via Skype™ to Snitch
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-19-2014 , 14:42   Re: Check CT Reconnect
Reply With Quote #2

If you want to hook "retry" command, it's not possible. If not please explain better.
__________________

Last edited by HamletEagle; 10-19-2014 at 14:42.
HamletEagle is offline
Snitch
Veteran Member
Join Date: Sep 2013
Location: Kazakhstan
Old 10-19-2014 , 15:39   Re: Check CT Reconnect
Reply With Quote #3

Quote:
Originally Posted by HamletEagle View Post
If you want to hook "retry" command, it's not possible. If not please explain better.
save player[ id ] when disconnect [reconnect] and check in connect to server if he's was CT before reconnect.

understand?
Snitch is offline
Send a message via Skype™ to Snitch
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 10-19-2014 , 18:48   Re: Check CT Reconnect
Reply With Quote #4

Quote:
Originally Posted by Snitch View Post
save player[ id ] when disconnect [reconnect] and check in connect to server if he's was CT before reconnect.

understand?
Can't do it that way as the player id changes. You would need to save by his unique userid with there steamid as key in nvault and they check when reconnect by matching there steamid to userid.
__________________
Blizzard_87 is offline
Snitch
Veteran Member
Join Date: Sep 2013
Location: Kazakhstan
Old 10-19-2014 , 19:06   Re: Check CT Reconnect
Reply With Quote #5

Quote:
Originally Posted by Blizzard_87 View Post
Can't do it that way as the player id changes. You would need to save by his unique userid with there steamid as key in nvault and they check when reconnect by matching there steamid to userid.
Thanks for the explanation, but I have no idea how to do it.

I need code like that, because i have problem in my Base Builder, players always do Retry and come back to CT Team
Snitch is offline
Send a message via Skype™ to Snitch
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 10-19-2014 , 20:58   Re: Check CT Reconnect
Reply With Quote #6

Block join CT altogether and have it randomly select players to join CT each round?
__________________
Blizzard_87 is offline
Snitch
Veteran Member
Join Date: Sep 2013
Location: Kazakhstan
Old 10-20-2014 , 01:15   Re: Check CT Reconnect
Reply With Quote #7

Quote:
Originally Posted by Blizzard_87 View Post
Block join CT altogether and have it randomly select players to join CT each round?
Uhm if u said...so can i have the plugin?
Snitch is offline
Send a message via Skype™ to Snitch
Blizzard_87
Veteran Member
Join Date: Oct 2012
Old 10-20-2014 , 03:15   Re: Check CT Reconnect
Reply With Quote #8

Quote:
Originally Posted by Snitch View Post
Uhm if u said...so can i have the plugin?
Wouldn't be scripting help if I just gave you the plugin?

Try it first and show us what you come up with?
__________________
Blizzard_87 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 17:36.


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