AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Check CT Reconnect (https://forums.alliedmods.net/showthread.php?t=250179)

Snitch 10-19-2014 14:27

Check CT Reconnect
 
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

HamletEagle 10-19-2014 14:42

Re: Check CT Reconnect
 
If you want to hook "retry" command, it's not possible. If not please explain better.

Snitch 10-19-2014 15:39

Re: Check CT Reconnect
 
Quote:

Originally Posted by HamletEagle (Post 2213152)
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?

Blizzard_87 10-19-2014 18:48

Re: Check CT Reconnect
 
Quote:

Originally Posted by Snitch (Post 2213185)
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.

Snitch 10-19-2014 19:06

Re: Check CT Reconnect
 
Quote:

Originally Posted by Blizzard_87 (Post 2213277)
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

Blizzard_87 10-19-2014 20:58

Re: Check CT Reconnect
 
Block join CT altogether and have it randomly select players to join CT each round?

Snitch 10-20-2014 01:15

Re: Check CT Reconnect
 
Quote:

Originally Posted by Blizzard_87 (Post 2213322)
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?

Blizzard_87 10-20-2014 03:15

Re: Check CT Reconnect
 
Quote:

Originally Posted by Snitch (Post 2213342)
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?


All times are GMT -4. The time now is 17:36.

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