#include <amxmodx>
#include <reapi>
enum Colors {
TT[3],
CT[3]
};
new g_eColors[Colors];
enum Cvars {
DHUD_TT_RGB[32],
DHUD_CT_RGB[32],
Float:DHUD_X,
Float:DHUD_Y,
Float:DHUD_HOLDTIME
};
new g_eCvars[Cvars];
public plugin_init() {
register_plugin("DHud Win Status", "1.0.3", "BiZaJe");
register_dictionary("DhudWinStatus.txt");
RegisterHookChain(RG_RoundEnd, "@HC_RoundEnd", true);
register_message(get_user_msgid("TextMsg"), "@MsgHook");
@RegisterCvars();
}
@MsgHook(iMsg, DestMsg, iEntMsg) {
static szMsg[32];
get_msg_arg_string(2, szMsg, charsmax(szMsg));
if(equal(szMsg, "#CTs_Win") || equal(szMsg, "#Terrorists_Win"))
return PLUGIN_HANDLED;
return PLUGIN_CONTINUE;
}
@HC_RoundEnd(WinStatus:iStatus, ScenarioEventEndRound:iEvent, Float:flDelay) {
if(iStatus != WINSTATUS_CTS && iStatus != WINSTATUS_TERRORISTS)
return;
switch(iStatus) {
case WINSTATUS_CTS: {
set_dhudmessage(g_eColors[CT][0], g_eColors[CT][1], g_eColors[CT][2], g_eCvars[DHUD_X], g_eCvars[DHUD_Y], .holdtime = g_eCvars[DHUD_HOLDTIME]);
switch(iEvent) {
case ROUND_BOMB_DEFUSED: show_dhudmessage(0, "%L", LANG_SERVER, "DHUD_WIN_BOMB_DEFUSED");
case ROUND_ALL_HOSTAGES_RESCUED: show_dhudmessage(0, "%L", LANG_SERVER, "DHUD_WIN_ALL_HOSTAGES_RESCUED");
default: show_dhudmessage(0, "%L", LANG_SERVER, "DHUD_WIN_CT");
}
}
case WINSTATUS_TERRORISTS: {
set_dhudmessage(g_eColors[TT][0], g_eColors[TT][1], g_eColors[TT][2], g_eCvars[DHUD_X], g_eCvars[DHUD_Y], .holdtime = g_eCvars[DHUD_HOLDTIME]);
switch(iEvent) {
case ROUND_TARGET_BOMB: show_dhudmessage(0, "%L", LANG_SERVER, "DHUD_WIN_BOMB_EXPLODE");
case ROUND_HOSTAGE_NOT_RESCUED: show_dhudmessage(0, "%L", LANG_SERVER, "DHUD_WIN_HOSTAGE_NOT_RESCUED");
default: show_dhudmessage(0, "%L", LANG_SERVER, "DHUD_WIN_TT");
}
}
}
}
@RegisterCvars() {
bind_pcvar_string(create_cvar(
"dhud_tt_rgb",
"245 30 30",
FCVAR_NONE,
"Цвет DHUD при победе TT(RGB)"),
g_eCvars[DHUD_TT_RGB],
charsmax(g_eCvars[DHUD_TT_RGB])
);
bind_pcvar_string(create_cvar(
"dhud_ct_rgb",
"80 79 208",
FCVAR_NONE,
"Цвет DHUD при победе CT(RGB)"),
g_eCvars[DHUD_CT_RGB],
charsmax(g_eCvars[DHUD_CT_RGB])
);
bind_pcvar_float(create_cvar(
"dhud_x",
"-1.0",
FCVAR_NONE,
"Позиция дхуд (X)"),
g_eCvars[DHUD_X]
);
bind_pcvar_float(create_cvar(
"dhud_y",
"0.25",
FCVAR_NONE,
"Позиция дхуд (Y)"),
g_eCvars[DHUD_Y]
);
bind_pcvar_float(create_cvar(
"dhud_holdtime",
"5.0",
FCVAR_NONE,
"Время сообщения на экране"),
g_eCvars[DHUD_HOLDTIME]
);
AutoExecConfig(true, "DhudWinStatus");
new szColors[32], iColors;
if(g_eCvars[DHUD_TT_RGB][0] != EOS)
while(argbreak(g_eCvars[DHUD_TT_RGB], szColors, charsmax(szColors), g_eCvars[DHUD_TT_RGB], charsmax(g_eCvars[DHUD_TT_RGB])) != -1)
g_eColors[TT][iColors++] = str_to_num(szColors);
iColors = 0;
if(g_eCvars[DHUD_CT_RGB][0] != EOS)
while(argbreak(g_eCvars[DHUD_CT_RGB], szColors, charsmax(szColors), g_eCvars[DHUD_CT_RGB], charsmax(g_eCvars[DHUD_CT_RGB])) != -1)
g_eColors[CT][iColors++] = str_to_num(szColors);
}