#include #include #include #include #include #include #include #define m_iVGUI 510 #define m_fGameHUDInitialized 349 new gp_TeamRatio new gp_CtMax new CTCount new TCount new g_MsgShowMenu public plugin_init() { register_plugin("TeamManager", "1", "Black"); register_dictionary("ujbm.txt") g_MsgShowMenu = get_user_msgid("ShowMenu") gp_TeamRatio = register_cvar("jb_teamratio", "3") gp_CtMax = register_cvar("jb_maxct", "6") } public count_teams() { CTCount = 0 TCount = 0 new Players[32] new playerCount, i get_players(Players, playerCount, "") for (i=0; i get_pcvar_num(gp_CtMax)) count = get_pcvar_num(gp_CtMax) if( count > CTCount ) { return true } return false } public team_choice(id, menu, item) { static dst[32], data[5], access, callback static restore, vgui, msgblock if(item == MENU_EXIT) { msgblock = get_msg_block(g_MsgShowMenu) set_msg_block(g_MsgShowMenu, BLOCK_ONCE) dllfunc(DLLFunc_ClientPutInServer, id) set_msg_block(g_MsgShowMenu, msgblock) set_pdata_int(id, m_fGameHUDInitialized, 1) menu_destroy(menu) return PLUGIN_HANDLED } restore = get_pdata_int(id, m_iVGUI) vgui = restore & (1<<0) if(vgui) set_pdata_int(id, m_iVGUI, restore & ~(1<<0)) // static roundloop //roundloop = floatround(get_pcvar_float(gp_RetryTime) / 2) //team_count() menu_item_getinfo(menu, item, access, data, charsmax(data), dst, charsmax(dst), callback) menu_destroy(menu) switch(data[0]) { case('1'): { msgblock = get_msg_block(g_MsgShowMenu) set_msg_block(g_MsgShowMenu, BLOCK_ONCE) set_msg_block(g_MsgShowMenu, msgblock) } case('2'): { if(is_ct_allowed() || is_user_admin(id)) { count_teams() msgblock = get_msg_block(g_MsgShowMenu) set_msg_block(g_MsgShowMenu, BLOCK_ONCE) set_msg_block(g_MsgShowMenu, msgblock) } else client_print(id, print_center, "%L", LANG_SERVER, "UJBM_TEAM_CTFULL") //if (g_RoundStarted >= roundloop) user_silentkill(id) } } if(vgui) set_pdata_int(id, m_iVGUI, restore) return PLUGIN_HANDLED } public jointeam(id) { return PLUGIN_HANDLED } public client_disconnect(id) { count_teams() }