Raised This Month: $51 Target: $400
 12% 

jointeam command


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
731
Member
Join Date: Aug 2006
Old 08-13-2022 , 22:31   jointeam command
Reply With Quote #1

why use jointeam 3 can't choose VIP
engclient_cmd(id, "jointeam", "3")
How to get the join VIP command

PHP Code:
/* AMX Mod X
*    Custom Team Select Menu
*    Code By baby
*    Credits:
*    VEN(Borrowed some code from his Auto Join on Connect :D)
*
*/

#include <amxmodx>

#define PLUGIN_NAME "custom team select menu"
#define PLUGIN_VERSION "0.10"
#define PLUGIN_AUTHOR "baby"

#define TEAM_SELECT_VGUI_MENU_ID 2

new bool:g_unassigned[33]
new 
bool:g_changed[33]
new 
g_msgid[33]
new 
p_allow_spectators
new p_teambalance
new p_limitteams
new bool:g_allow_t
new bool:g_allow_ct
new bool:g_allow_spec
new g_num_tg_num_ct
new g_MapName[32], bool:g_VIPMap false

#define Keysmenu_1 (1<<0)|(1<<1)|(1<<2)|(1<<4)|(1<<5)|(1<<9) // Keys: 123560
#define Keysmenu_2 (1<<0)|(1<<1)|(1<<2)|(1<<4)|(1<<5)|(1<<9) // Keys: 123560

public plugin_init() {
    
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)
    
register_message(get_user_msgid("ShowMenu"), "message_show_menu")
    
register_message(get_user_msgid("VGUIMenu"), "message_vgui_menu")
    
register_menucmd(register_menuid("mainmenu"), Keysmenu_1"_menu_chooseteam")
    
register_logevent("hook_roundstart",2,"1=Round_Start")
    
p_allow_spectators get_cvar_pointer("allow_spectators")
    
p_teambalance get_cvar_pointer"mp_autoteambalance" )
    
p_limitteams get_cvar_pointer"mp_limitteams" )
    
register_clcmd("chooseteam""hook_chooseteam")
    
get_mapname(g_MapNamecharsmax(g_MapName))
    if(
containi(g_MapName"as_") != -1g_VIPMap true
}

public 
hook_roundstart()
{
    for (new 
133i++)
    {
        
g_changed[i] = false
    
}
}

public 
client_connect(id)
{
    
g_changed[id] = false
    g_unassigned
[id] = true
}

public 
client_disconnect(id)
{
    
g_changed[id] = false
    g_unassigned
[id] = true
}
public 
hook_chooseteam(id)
{
    
menu_chooseteam(id)
    return 
PLUGIN_HANDLED
}

stock team_join(idteam[] = "5")
{
    new 
menu_msgid g_msgid[id]
    new 
msg_block get_msg_block(menu_msgid)
    
set_msg_block(menu_msgidBLOCK_SET)
    
engclient_cmd(id"jointeam"team)
    
set_msg_block(menu_msgidmsg_block)
}

public 
menu_choosemodel_t(id)
{
    new 
menu menu_create("\yTerrorist Model Selection::""_menu_choosemodel_t")
    
menu_additem(menu"\wPhoenix Connexion""1"0);
    
menu_additem(menu"\wElite Crew""2"0);
    
menu_additem(menu"\wArctic Avengers""3"0);
    
menu_additem(menu"\wGuerilla Warfare^n""4"0);
    
menu_additem(menu"\wAuto-select""5"0);
    
menu_setprop(menuMPROP_EXITNAME"\rExit^n^n\r>>\whttps://www.amxmodx.org/");
    
menu_display(idmenu0);
}
public 
_menu_choosemodel_t(idmenuitem)
{
    new 
data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    new 
menu_msgid g_msgid[id]
    new 
msg_block get_msg_block(menu_msgid)
    
set_msg_block(menu_msgidBLOCK_SET)
    
engclient_cmd(id"joinclass"data)
    
set_msg_block(menu_msgidmsg_block)
    
g_changed[id] = true
    g_unassigned
[id] = false
    menu_destroy
(menu);
    return 
PLUGIN_HANDLED;
}

public 
menu_choosemodel_ct(id)
{
    new 
menu menu_create("\yCT Model Selection::""_menu_choosemodel_ct")
    
menu_additem(menu"\wSeal Team 6""1"0);
    
menu_additem(menu"\wGSG-9""2"0);
    
menu_additem(menu"\wSAS""3"0);
    
menu_additem(menu"\wGIGN^n""4"0);
    
menu_additem(menu"\wAuto-select""5"0);
    
menu_setprop(menuMPROP_EXITNAME"\rExit^n^n\r>>\whttps://www.amxmodx.org/");
    
menu_display(idmenu0);
}
public 
_menu_choosemodel_ct(idmenuitem)
{
    new 
data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    new 
menu_msgid g_msgid[id]
    new 
msg_block get_msg_block(menu_msgid)
    
set_msg_block(menu_msgidBLOCK_SET)
    
engclient_cmd(id"joinclass"data)
    
set_msg_block(menu_msgidmsg_block)
    
g_changed[id] = true
    g_unassigned
[id] = false
    menu_destroy
(menu);
    return 
PLUGIN_HANDLED;
}

public 
menu_chooseteam(id)
{
    if (
is_user_connected(id) && !is_user_bot(id) && !is_user_hltv(id))
    {
        
check_teams(id)
        new 
text[512], len
        len 
format(text511,"\ySelect Your Team^n^n")
        if (
g_changed[id])
        {
            
len += format(text[len], 511 len"\w>>Only 1 team change is allowed.::^n")
            
len += format(text[len], 511 len"\d1. Terrorist Force^n")
            
len += format(text[len], 511 len"\d2. Counter-Terrorist Force^n")
            if(
g_VIPMap)
            {
                
len += format(text[len], 511 len"\d3. VIP^n")
            }
            
len += format(text[len], 511 len,  "\d5. Auto-select^n"
            
len += format(text[len], 511 len"\d6. Spectator^n^n")
        }
        else
        { 
            
len += format(text[len], 511 len"\r>>Choose the team you want to join::^n")
            
len += format(text[len], 511 len"\r1. \wTerrorist Force^n")
            
len += format(text[len], 511 len"\r2. \wCounter-Terrorist Force^n")
            if(
g_VIPMap)
            {
                
len += format(text[len], 511 len"\r3. \wVIP^n")
            }
            
len += format(text[len], 511 len"\r5. \wAuto-select^n")
        }
        if ((
g_allow_spec && !g_changed[id]))
        {
            
len += format(text[len], 511 len"\r6. \wSpectator^n^n")
            
len += format(text[len], 511 len"^n\r0. Exit^n^n")
            
len += format(text[len], 511 len"\r>>\whttps://www.amxmodx.org/")
            
show_menu(idKeysmenu_1text, -1"mainmenu")
        }
        else
        {
            
len += format(text[len], 511 len"^n\r0. Exit^n^n")
            
len += format(text[len], 511 len"\r>>\whttps://www.amxmodx.org/")
            
show_menu(idKeysmenu_2text, -1"mainmenu")
        }
    }
}

public 
_menu_chooseteam(idkey)
{
    
check_teams(id)
    switch(
key)
    {
        case 
0:
        {
            if (
g_allow_t && !g_changed[id])
            {
                
team_join(id"1")
                
menu_choosemodel_t(id)
            }
        }
        case 
1:
        {
            if (
g_allow_ct && !g_changed[id])
            {
                
team_join(id"2")
                
menu_choosemodel_ct(id)
            }
        }
        case 
2:
        {
            if (
g_VIPMap && !g_changed[id])
            {
                
team_join(id"3")
            }
        }
        case 
4:
        {
            if (!
g_changed[id])
            {
                if (
g_allow_t && g_allow_ct)
                {
                    if (
get_systime() % 2)
                    {
                        
team_join(id"1")
                        
menu_choosemodel_t(id)
                    }
                    else
                    {
                        
team_join(id"2")
                        
menu_choosemodel_ct(id)
                    }
                }
                else if (
g_allow_t)
                {
                    
team_join(id"1")
                    
menu_choosemodel_t(id)
                }
                else if (
g_allow_ct)
                {
                    
team_join(id"2")
                    
menu_choosemodel_ct(id)
                }
            }
        }
        case 
5:
        {
            if (!
g_changed[id])
            {
                
force_team_join(idg_msgid[id], "6"_)
            }
        }
        case 
9:
        {
            return 
PLUGIN_HANDLED;
        }
    }
    return 
PLUGIN_HANDLED;
}

public 
message_show_menu(msgiddestid) {
    static 
team_select[] = "#Team_Select"
    
static menu_text_code[sizeof team_select]
    
get_msg_arg_string(4menu_text_codesizeof menu_text_code 1)
    if (!
equal(menu_text_codeteam_select))
        return 
PLUGIN_CONTINUE
    g_msgid
[id] = msgid
    menu_chooseteam
(id)
    return 
PLUGIN_HANDLED
}

public 
message_vgui_menu(msgiddestid) {
    if (
get_msg_arg_int(1) != TEAM_SELECT_VGUI_MENU_ID)
        return 
PLUGIN_CONTINUE
    g_msgid
[id] = msgid
    menu_chooseteam
(id)
    return 
PLUGIN_HANDLED
}

public 
check_teams(id)
{
    
g_allow_ttrue
    g_allow_ct 
true
    
new playerst[32], playersct[32]
    
get_players(playerstg_num_t"eh""TERRORIST")
    
get_players(playersctg_num_ct"eh""CT")
    if (
get_pcvar_num(p_allow_spectators) && (g_num_t g_num_ct || g_unassigned[id]))
    {
        
g_allow_spec true
    
}
    else
    {
        
g_allow_spec false
    
}
    if (
get_user_team(id) == 2)//ct
    
{
        
g_num_ct--
    }
    else if (
get_user_team(id) == 1)//t
    
{
        
g_num_t--
    }
    if (
get_pcvar_num(p_teambalance))
    {
        new 
limit get_pcvar_num(p_limitteams)
        if (
g_num_t g_num_ct >= limit)
        {
            
g_allow_t false
        
}
        else if (
g_num_ct g_num_t >= limit)
        {
            
g_allow_ct false
        
}
    }
}

stock force_team_join(idmenu_msgidteam[] = "5",  class[] = "0") {
    static 
jointeam[] = "jointeam"
    
if (class[0] == '0') {
        
engclient_cmd(idjointeamteam)
        
g_changed[id] = true
        g_unassigned
[id] = false
        
return
    }
    static 
msg_blockjoinclass[] = "joinclass"
    
msg_block get_msg_block(menu_msgid)
    
set_msg_block(menu_msgidBLOCK_SET)
    
engclient_cmd(idjointeamteam)
    
engclient_cmd(idjoinclass, class)
    
set_msg_block(menu_msgidmsg_block)
    
g_changed[id] = true
    g_unassigned
[id] = false

731 is online now
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 08:04.


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