team join

Šiame forume rašomi vartotojų klausimai/problemos su kuriomis jie susidūrė kuriant pluginus.
Post Reply
User avatar
aurimasko
Flooderis arba specialistas
Posts: 736
Joined: 2010 Sep 04 08:45

team join

Post by aurimasko »

Code: Select all

#define TEAM_MENU       "#Team_Select_Spect"#define TEAM_MENU2  "#Team_Select_Spect" new g_MsgVGUIMenunew g_MsgShowMenu g_MsgVGUIMenu = get_user_msgid("VGUIMenu")g_MsgShowMenu = get_user_msgid("ShowMenu") register_message(g_MsgVGUIMenu, "msg_vguimenu")register_message(g_MsgShowMenu, "msg_showmenu") register_menucmd(register_menuid(TEAM_MENU), 51, "team_select") register_menucmd(register_menuid(TEAM_MENU2), 51, "team_select")  register_clcmd("jointeam", "cmd_jointeam")register_clcmd("joinclass", "cmd_joinclass")  public msg_vguimenu(msgid, dest, id){    static msgarg1    static CsTeams:team     msgarg1 = get_msg_arg_int(1)    if(msgarg1 == 2)    {        team = cs_get_user_team(id)        if((team == CS_TEAM_T) && (is_user_alive(id) || !get_pcvar_num(gp_TeamChange)))        {            client_print(id, print_center, "%L", LANG_SERVER, "JBE_TEAM_CANTCHANGE")            return PLUGIN_HANDLED        }        show_menu(id, 51, TEAM_MENU, -1)        return PLUGIN_HANDLED    }     return PLUGIN_CONTINUE} public msg_showmenu(msgid, dest, id){    static msgarg1, roundloop    static CsTeams:team    msgarg1 = get_msg_arg_int(1)     if(msgarg1 != 531 && msgarg1 != 563)        return PLUGIN_CONTINUE     roundloop = floatround(get_pcvar_float(gp_RetryTime) / 2)    team = cs_get_user_team(id)     if(team == CS_TEAM_T)    {        if((is_user_alive(id) || (g_RoundStarted >= roundloop) || !get_pcvar_num(gp_TeamChange)))        {            client_print(id, print_center, "%L", LANG_SERVER, "JBE_TEAM_CANTCHANGE")            return PLUGIN_HANDLED        }        else        {            show_menu(id, 51, TEAM_MENU, -1)            return PLUGIN_HANDLED        }    }    else    {        show_menu(id, 51, TEAM_MENU, -1)        return PLUGIN_HANDLED    }     return PLUGIN_CONTINUE}  public cmd_jointeam(id){    return PLUGIN_HANDLED} public cmd_joinclass(id){    return PLUGIN_HANDLED}  public team_select(id, key){    static CsTeams:team, roundloop     roundloop = get_pcvar_num(gp_RetryTime) / 2    team = cs_get_user_team(id)    team_count()     if((team == CS_TEAM_UNASSIGNED) && (g_RoundStarted >= roundloop) && g_TeamCount[CS_TEAM_CT] && g_TeamCount[CS_TEAM_T] && !is_user_alive(id))    {        team_join(id, CS_TEAM_SPECTATOR)        client_print(id, print_center, "%L", LANG_SERVER, "JBE_TEAM_CANTJOIN")        return PLUGIN_HANDLED    }      switch(key)    {        case(0):        {            if(team == CS_TEAM_T)                return PLUGIN_HANDLED             team_join(id, CS_TEAM_T)        }        case(1):        {            if(team == CS_TEAM_CT )                return PLUGIN_HANDLED             if(g_TeamCount[CS_TEAM_CT] < ctcount_allowed())                team_join(id, CS_TEAM_CT)            else                client_print(id, print_center, "%L", LANG_SERVER, "JBE_TEAM_CTFULL")        }        case(5):        {            user_silentkill(id)            team_join(id, CS_TEAM_SPECTATOR)        }    }    return PLUGIN_HANDLED} public team_join(id, CsTeams:team){    static restore, vgui, msgblock     restore = get_pdata_int(id, m_iVGUI)    vgui = restore & (1<<0)    if(vgui)        set_pdata_int(id, m_iVGUI, restore & ~(1<<0))     switch(team)    {        case CS_TEAM_SPECTATOR:        {            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)            engclient_cmd(id, "jointeam", "6")        }        case CS_TEAM_T, CS_TEAM_CT:        {            msgblock = get_msg_block(g_MsgShowMenu)            set_msg_block(g_MsgShowMenu, BLOCK_ONCE)            engclient_cmd(id, "jointeam", (team == CS_TEAM_CT) ? "2" : "1")            engclient_cmd(id, "joinclass", "1")            set_msg_block(g_MsgShowMenu, msgblock)        }    }        if(vgui)        set_pdata_int(id, m_iVGUI, restore)}  


kodėl kai kuriuos žaidėjus iškarto tik prisijungus imeta į teroristus, o kitiems duoda pasirinkti iš menu komandą?

Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 1 guest