Raised This Month: $32 Target: $400
 8% 

Help plugin (only team t)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jah Khalib
Member
Join Date: Sep 2018
Old 09-10-2018 , 14:38   Help plugin (only team t)
Reply With Quote #1

Hello, I want a plugin that blocks the CT team, ie when the players enter the server to automatically put them on the team T. I use pubg by EFFx mod, I added the auto_join plugin but it does not work after the round restarts (sv_restart).
Jah Khalib is offline
By Hazard
Member
Join Date: Jan 2016
Old 09-11-2018 , 10:55   Re: Help plugin (only team t)
Reply With Quote #2

Quote:
Originally Posted by Jah Khalib View Post
Hello, I want a plugin that blocks the CT team, ie when the players enter the server to automatically put them on the team T. I use pubg by EFFx mod, I added the auto_join plugin but it does not work after the round restarts (sv_restart).
My inserts will work. Activate both.

Team obstacle

PHP Code:
#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Team Obstacle"
#define VERSION "V.1"
#define AUTHOR "By Hazard"
new gCvarPluginToggle

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_concmd("jointeam""bugfix")
    
register_concmd("chooseteam""bugfix")
    
gCvarPluginToggle register_cvar("amx_block_team""1")
}

public 
bugfix(id)
{
         
// If the plugin don't get the CVAR, it makes you buy normally. 
    
if (!get_pcvar_num(gCvarPluginToggle)) 
        return 
PLUGIN_CONTINUE
     
client_color(id"!t[TAG] !yChanging the team is forbidden.")
    
// Block the buy commands. 
    
return PLUGIN_HANDLED;
}
        
stock client_color( const id, const input[ ], any:... )
{
    new 
count 1players32 ]

    static 
msg191 ]
    
vformatmsg190input)
    
    
replace_allmsg190"!y""^4" /* green */
    
replace_allmsg190"!s""^1" /* yellow */
    
replace_allmsg190"!t""^3" /* ct=blue | t=red */
    
replace_allmsg190"!n""^0" /* Normal */
    
    
if( id players] = id; else get_playersplayerscount"ch" )
    {
        for( new 
0counti++ )
        {
            if( 
is_user_connectedplayers] ) )
            {
                
message_beginMSG_ONE_UNRELIABLEget_user_msgid"SayText" ), _players] )
                
write_byteplayers] );
                
write_stringmsg );
                
message_end( );
            }
        }
    }

Team join 'T'

PHP Code:
#include <amxmodx>

enum
{
    
TEAM_NONE 0,
    
TEAM_T,
    
TEAM_CT,
    
TEAM_SPEC,
    
    
MAX_TEAMS
};
new const 
g_cTeamChars[MAX_TEAMS] =
{
    
'U',
    
'T',
    
'C',
    
'S'
};
new const 
g_sTeamNums[MAX_TEAMS][] =
{
    
"0",
    
"1",
    
"2",
    
"3"
};
new const 
g_sClassNums[MAX_TEAMS][] =
{
    
"1",
    
"2",
    
"3",
    
"4"
};

// Old Style Menus
stock const FIRST_JOIN_MSG[] =        "#Team_Select";
stock const FIRST_JOIN_MSG_SPEC[] =    "#Team_Select_Spect";
stock const INGAME_JOIN_MSG[] =        "#IG_Team_Select";
stock const INGAME_JOIN_MSG_SPEC[] =    "#IG_Team_Select_Spect";
const 
iMaxLen sizeof(INGAME_JOIN_MSG_SPEC);

// New VGUI Menus
stock const VGUI_JOIN_TEAM_NUM =        2;

new 
g_iTeam[33];
new 
g_iPlayers[MAX_TEAMS];

new 
tjm_join_team;
new 
tjm_switch_team;
new 
tjm_class[MAX_TEAMS];
new 
tjm_block_change;

public 
plugin_init()
{
    
register_plugin("Team Join Management""0.3""Exolent");
    
register_event("TeamInfo""event_TeamInfo""a");
    
register_message(get_user_msgid("ShowMenu"), "message_ShowMenu");
    
register_message(get_user_msgid("VGUIMenu"), "message_VGUIMenu");
    
tjm_join_team register_cvar("tjm_join_team""1");
    
tjm_switch_team register_cvar("tjm_switch_team""1");
    
tjm_class[TEAM_T] = register_cvar("tjm_class_t""5");
    
tjm_class[TEAM_CT] = register_cvar("tjm_class_ct""5");
    
tjm_block_change register_cvar("tjm_block_change""1");
}

public 
plugin_cfg()
{
    
set_cvar_num("mp_limitteams"32);
    
set_cvar_num("sv_restart"1);
}

public 
client_disconnected(id)
{
    
remove_task(id);
}

public 
event_TeamInfo()
{
    new 
id read_data(1);
    new 
sTeam[32], iTeam;
    
read_data(2sTeamsizeof(sTeam) - 1);
    for(new 
0MAX_TEAMSi++)
    {
        if(
g_cTeamChars[i] == sTeam[0])
        {
            
iTeam i;
            break;
        }
    }
    
    if(
g_iTeam[id] != iTeam)
    {
        
g_iPlayers[g_iTeam[id]]--;
        
g_iTeam[id] = iTeam;
        
g_iPlayers[iTeam]++;
    }
}

public 
message_ShowMenu(iMsgidiDestid)
{
    static 
sMenuCode[iMaxLen];
    
get_msg_arg_string(4sMenuCodesizeof(sMenuCode) - 1);
    if(
equal(sMenuCodeFIRST_JOIN_MSG) || equal(sMenuCodeFIRST_JOIN_MSG_SPEC))
    {
        if(
should_autojoin(id))
        {
            
set_autojoin_task(idiMsgid);
            return 
PLUGIN_HANDLED;
        }
    }
    else if(
equal(sMenuCodeINGAME_JOIN_MSG) || equal(sMenuCodeINGAME_JOIN_MSG_SPEC))
    {
        if(
should_autoswitch(id))
        {
            
set_autoswitch_task(idiMsgid);
            return 
PLUGIN_HANDLED;
        }
        else if(
get_pcvar_num(tjm_block_change))
        {
            return 
PLUGIN_HANDLED;
        }
    }
    return 
PLUGIN_CONTINUE;
}

public 
message_VGUIMenu(iMsgidiDestid)
{
    if(
get_msg_arg_int(1) != VGUI_JOIN_TEAM_NUM)
    {
        return 
PLUGIN_CONTINUE;
    }
    
    if(
should_autojoin(id))
    {
        
set_autojoin_task(idiMsgid);
        return 
PLUGIN_HANDLED;
    }
    else if(
should_autoswitch(id))
    {
        
set_autoswitch_task(idiMsgid);
        return 
PLUGIN_HANDLED;
    }
    else if((
TEAM_NONE g_iTeam[id] < TEAM_SPEC) && get_pcvar_num(tjm_block_change))
    {
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_CONTINUE;
}

public 
task_Autojoin(iParam[], id)
{
    new 
iTeam get_new_team(get_pcvar_num(tjm_join_team));
    if(
iTeam != -1)
    {
        
handle_join(idiParam[0], iTeam);
    }
}

public 
task_Autoswitch(iParam[], id)
{
    new 
iTeam get_switch_team(id);
    if(
iTeam != -1)
    {
        
handle_join(idiParam[0], iTeam);
    }
}

stock handle_join(idiMsgidiTeam)
{
    new 
iMsgBlock get_msg_block(iMsgid);
    
set_msg_block(iMsgidBLOCK_SET);
    
    
engclient_cmd(id"jointeam"g_sTeamNums[iTeam]);
    
    new 
iClass get_team_class(iTeam);
    if(
<= iClass <= 4)
    {
        
engclient_cmd(id"joinclass"g_sClassNums[iClass 1]);
    }
    
set_msg_block(iMsgidiMsgBlock);
}

stock get_new_team(iCvar)
{
    switch(
iCvar)
    {
        case 
1:
        {
            return 
TEAM_T;
        }
        case 
2:
        {
            return 
TEAM_CT;
        }
        case 
3:
        {
            return 
TEAM_SPEC;
        }
        case 
4:
        {
            new 
iTCount g_iPlayers[TEAM_T];
            new 
iCTCount g_iPlayers[TEAM_CT];
            if(
iTCount iCTCount)
            {
                return 
TEAM_T;
            }
            else if(
iTCount iCTCount)
            {
                return 
TEAM_CT;
            }
            else
            {
                return 
random_num(TEAM_TTEAM_CT);
            }
        }
    }
    return -
1;
}

stock get_switch_team(id)
{
    new 
iTeam;
    
    new 
iTCount g_iPlayers[TEAM_T];
    new 
iCTCount g_iPlayers[TEAM_CT];
    switch(
g_iTeam[id])
    {
        case 
TEAM_TiTCount--;
        case 
TEAM_CTiCTCount--;
    }
    if(
iTCount iCTCount)
    {
        
iTeam TEAM_T;
    }
    else if(
iTCount iCTCount)
    {
        
iTeam TEAM_CT;
    }
    else
    {
        
iTeam random_num(TEAM_TTEAM_CT);
    }
    
    if(
iTeam != g_iTeam[id])
    {
        return 
iTeam;
    }
    
    return -
1;
}

stock get_team_class(iTeam)
{
    new 
iClass;
    if(
TEAM_NONE iTeam TEAM_SPEC)
    {
        
iClass get_pcvar_num(tjm_class[iTeam]);
        if(
iClass || iClass 4)
        {
            
iClass random_num(14);
        }
    }
    return 
iClass;
}

stock set_autojoin_task(idiMsgid)
{
    new 
iParam[2];
    
iParam[0] = iMsgid;
    
set_task(0.1"task_Autojoin"idiParamsizeof(iParam));
}

stock set_autoswitch_task(idiMsgid)
{
    new 
iParam[2];
    
iParam[0] = iMsgid;
    
set_task(0.1"task_Autoswitch"idiParamsizeof(iParam));
}

stock bool:should_autojoin(id)
{
    return ((
get_pcvar_num(tjm_join_team) > 0) && is_user_connected(id) && !(TEAM_NONE g_iTeam[id] < TEAM_SPEC) && !task_exists(id));
}

stock bool:should_autoswitch(id)
{
    return (
get_pcvar_num(tjm_switch_team) && is_user_connected(id) && (TEAM_NONE g_iTeam[id] < TEAM_SPEC) && !task_exists(id));

By Hazard is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 09-11-2018 , 12:05   Re: Help plugin (only team t)
Reply With Quote #3

mp_autoteambalance 0
mp_limitteams 0
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 09-11-2018 , 14:09   Re: Help plugin (only team t)
Reply With Quote #4

And use this this for add more spawn points.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 09-11-2018 at 14:09.
EFFx is offline
Jah Khalib
Member
Join Date: Sep 2018
Old 09-11-2018 , 16:44   Re: Help plugin (only team t)
Reply With Quote #5

Thx guys resolved ;3
Jah Khalib 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 20:43.


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