Руслан Миронов
Пользователь
- Регистрация
- 24 Июн 2017
- Сообщения
- 276
- Симпатии
- 3
- Предупреждения
- 30
- Пол
- Мужской
Добрый вечер можете плагин переписать цвет как на скрине?
Код:
#include <amxmodx>
#include <reapi>
enum { MODE_NORMAL_TEAM, MODE_RANDOM_TEAM }
enum { SPEC_ALWAYS, SPEC_AFTER_JOIN }
new HookChain:HookShowMenuPre
new Mode, Spectators, Appearance, Unlimited, Float:TimeLimit, AdminFlags = ADMIN_BAN, Autojoin, AutojoinImminity = ADMIN_BAN
new Float:NextChooseTeamTime[MAX_PLAYERS + 1]
public plugin_init()
{
register_plugin("Team Select", "1.5.0", "F@nt0M")
register_dictionary("teamselect.txt")
RegisterHookChain(RG_ShowVGUIMenu, "ShowVGUIMenu_Pre", false)
RegisterHookChain(RG_HandleMenu_ChooseTeam, "HandleMenu_ChooseTeam_Pre", false)
RegisterHookChain(RG_HandleMenu_ChooseTeam, "HandleMenu_ChooseTeam_Post", true)
DisableHookChain(HookShowMenuPre = RegisterHookChain(RG_ShowMenu, "ShowMenu_Pre", false))
new pcvar
pcvar = create_cvar("amx_ts_mode", "0", FCVAR_SERVER, fmt("%L", LANG_SERVER, "TS_MODE_DESC"), true, 0.0, true, 1.0)
bind_pcvar_num(pcvar, Mode)
pcvar = create_cvar("amx_ts_spec", "0", FCVAR_SERVER, fmt("%L", LANG_SERVER, "TS_SPEC_DESC"), true, 0.0, true, 1.0)
bind_pcvar_num(pcvar, Spectators)
pcvar = create_cvar("amx_ts_appearance", "0", FCVAR_SERVER, fmt("%L", LANG_SERVER, "TS_APPEARANCE_DESC"), true, 0.0, true, 1.0)
bind_pcvar_num(pcvar, Appearance)
pcvar = create_cvar("amx_ts_unlimited", "0", FCVAR_SERVER, fmt("%L", LANG_SERVER, "TS_UNLIMITED_DESC"), true, 0.0, true, 1.0)
bind_pcvar_num(pcvar, Unlimited)
pcvar = create_cvar("amx_ts_time_limit", "0.0", FCVAR_SERVER, fmt("%L", LANG_SERVER, "TS_TIME_LIMIT_DESC"), true, 0.0)
bind_pcvar_float(pcvar, TimeLimit)
pcvar = create_cvar("amx_ts_autojoin", "0", FCVAR_SERVER, fmt("%L", LANG_SERVER, "TS_AUTOJOIN_DESC"), true, 0.0, true, 1.0)
bind_pcvar_num(pcvar, Autojoin)
pcvar = create_cvar("amx_ts_admin_flags", "", FCVAR_SERVER, fmt("%L", LANG_SERVER, "TS_FLAGS_DESC"))
hook_cvar_change(pcvar, "HookChangeFlag")
pcvar = create_cvar("amx_ts_autojoin_immunity", "", FCVAR_SERVER, fmt("%L", LANG_SERVER, "TS_AUTOJOIN_IMMUNITY_DESC"), true, 0.0, true, 1.0)
hook_cvar_change(pcvar, "HookChangeImmunity")
}
public HookChangeFlag(const pcvar, const oldValue[], const newValue[]) AdminFlags = read_flags(newValue);
public HookChangeImmunity(const pcvar, const oldValue[], const newValue[]) AutojoinImminity = read_flags(newValue);
public client_putinserver(id)
{
NextChooseTeamTime[id] = 0.0;
if (!Autojoin) return
if (AutojoinImminity && (get_user_flags(id) & AutojoinImminity == AutojoinImminity)) return
rg_join_team(id, rg_get_join_team_priority())
}
public ShowVGUIMenu_Pre(const id, VGUIMenu:menuType)
{
if (is_user_bot(id) || menuType != VGUI_Menu_Team) return HC_CONTINUE
if (TimeLimit && NextChooseTeamTime[id] >= get_gametime())
{
client_printex(id, print_center, "#Only_1_Team_Change")
return HC_SUPERCEDE
}
new bool:newPlayer = bool:(TeamName:get_member(id, m_iTeam) == TEAM_UNASSIGNED)
SetGlobalTransTarget(id)
new menu[MAX_MENU_LENGTH], keys
new len = formatex(menu, charsmax(menu), "\w%l^n^n", "TS_SELECT_TEAM")
if (Mode == MODE_NORMAL_TEAM)
{
len += formatex(menu[len], charsmax(menu) - len, "\d[\r1\d] \r%l \d[\y%d\d]^n", "TS_TEAM_T", get_member_game(m_iNumTerrorist))
len += formatex(menu[len], charsmax(menu) - len, "\d[\r2\d] \r%l \d[\y%d\d]^n", "TS_TEAM_CT", get_member_game(m_iNumCT))
keys |= MENU_KEY_1 | MENU_KEY_2
}
else
{
len += formatex(menu[len], charsmax(menu) - len, "\d[\r1\d] \r%l^n", newPlayer ? "TS_ENTER_GAME" : "TS_CHANGE_TEAM")
keys |= MENU_KEY_1
}
if (Spectators == SPEC_ALWAYS || (Spectators == SPEC_AFTER_JOIN && !newPlayer) || (AdminFlags && (get_user_flags(id) & AdminFlags) == AdminFlags))
{
len += formatex(menu[len], charsmax(menu) - len, "^n\d[\r6\d] \w%l^n", "TS_SPECTATOR")
keys |= MENU_KEY_6
}
if (!newPlayer)
{
len += formatex(menu[len], charsmax(menu) - len, "^n^n\d[\r0\d] \w%l^n", "TS_CLOSE")
keys |= MENU_KEY_0
}
set_member(id, m_bForceShowMenu, true)
SetHookChainArg(3, ATYPE_INTEGER, keys)
SetHookChainArg(4, ATYPE_STRING, menu)
if (strlen(menu) > 192) EnableHookChain(HookShowMenuPre)
return HC_CONTINUE
}
// Fix menu limit in ReGameDLL (https://github.com/s1lentq/ReGameDLL_CS/blob/9d89a347fa22662b716697c97150ddea2bd00d99/regamedll/dlls/client.cpp#L394)
public ShowMenu_Pre(const id, const keys, const time, const needMore, const menu[])
{
DisableHookChain(HookShowMenuPre)
show_menu(id, keys, menu, time)
set_member(id, m_iMenu, Menu_ChooseTeam) // AMXX overide m_iMenu after show_menu
return HC_SUPERCEDE
}
public HandleMenu_ChooseTeam_Pre(const id, const MenuChooseTeam:slot) {
if (is_user_bot(id)) return HC_CONTINUE
if (slot == MenuChoose_Spec)
{
if (is_user_alive(id)) user_silentkill(id)
}
else
{
if (Mode == MODE_RANDOM_TEAM)
{
new MenuChooseTeam:team
switch (TeamName:get_member(id, m_iTeam)) {
case TEAM_TERRORIST: team = MenuChoose_CT
case TEAM_CT: team = MenuChoose_T
default: team = MenuChoose_AutoSelect
}
SetHookChainArg(2, ATYPE_INTEGER, team)
}
if (!Appearance)
{
if (is_user_alive(id)) user_silentkill(id)
set_member_game(m_bSkipShowMenu, true)
}
}
return HC_CONTINUE
}
public HandleMenu_ChooseTeam_Post(const id, const MenuChooseTeam:slot)
{
if (!GetHookChainReturn(ATYPE_INTEGER)) return
if (Unlimited) set_member(id, m_bTeamChanged, false)
NextChooseTeamTime[id] = get_gametime() + TimeLimit
if (slot == MenuChoose_Spec || Appearance) return
set_member_game(m_bSkipShowMenu, false)
if (get_member(id, m_bJustConnected))
{
set_member(id, m_iJoiningState, GETINTOGAME)
set_member(id, m_bJustConnected, false)
}
set_member(id, m_iMenu, Menu_ChooseAppearance)
rg_internal_cmd(id, "joinclass", "5")
}
Вложения
-
17,6 KB Просмотры: 49
-
5,5 KB Просмотры: 9
-
2,6 KB Просмотры: 6
Последнее редактирование: