#include <amxmodx>
#include <reapi>
new Message[][] = {
"#CTs_Win",
"#Terrorists_Win"
}
enum WinCvars{
Float:DHUD_WIN_X,
Float:DHUD_WIN_Y,
Float:DHUD_HOLDTIME,
DHUD_WIN_CT_R,
DHUD_WIN_CT_G,
DHUD_WIN_CT_B,
DHUD_WIN_TT_R,
DHUD_WIN_TT_G,
DHUD_WIN_TT_B
}
new g_WinCvars[WinCvars];
public plugin_init(){
register_plugin("DHud Win Status", "1.0.2", "BiZaJe");
register_dictionary("DhudWinStatus.txt");
RegisterHookChain(RG_RoundEnd, "@HC_RoundEnd", .post = true);
register_message(get_user_msgid("TextMsg"), "@MsgHook");
@RegisterCvars();
}
@MsgHook(iMsg, DestMsg, iEntMsg)
{
static szMsg[64], newMsg[64], dummy;
get_msg_arg_string(2, szMsg, charsmax(szMsg));
if (!LookupLangKey(newMsg, charsmax(newMsg), szMsg[1], dummy))
return
new argC = get_msg_args()
if (argC >= 3) {
for (new i = 3; i <= argC; i++) {
static arg[32]
get_msg_arg_string(i, arg, charsmax(arg))
replace(newMsg, charsmax(newMsg), "%s", arg)
}
}
strcat(newMsg, "^n", charsmax(newMsg))
set_msg_arg_string(2, newMsg)
set_dhudmessage(255,255,255)
show_dhudmessage(0, newMsg)
for(new i = 0; i < sizeof(Message); i++){
if(equal(szMsg, Message[i])){
return;
}
}
}
@HC_RoundEnd(WinStatus:iStatus, ScenarioEventEndRound:iEvent, Float:flDelay)
{
if(iStatus != WINSTATUS_CTS && iStatus != WINSTATUS_TERRORISTS)
return;
switch(iStatus){
case WINSTATUS_CTS:{
set_dhudmessage(.red = g_WinCvars[DHUD_WIN_CT_R], .green = g_WinCvars[DHUD_WIN_CT_G], .blue = g_WinCvars[DHUD_WIN_CT_B], .x = g_WinCvars[DHUD_WIN_X], .y = g_WinCvars[DHUD_WIN_Y], .holdtime = g_WinCvars[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(.red = g_WinCvars[DHUD_WIN_TT_R], .green = g_WinCvars[DHUD_WIN_TT_G], .blue = g_WinCvars[DHUD_WIN_TT_B], .x = g_WinCvars[DHUD_WIN_X], .y = g_WinCvars[DHUD_WIN_Y], .holdtime = g_WinCvars[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_float(create_cvar(
"dhud_win_x",
"-1.0",
FCVAR_NONE,
"Позиция дхуд (X)"),
g_WinCvars[DHUD_WIN_X]
);
bind_pcvar_float(create_cvar(
"dhud_win_y",
"0.25",
FCVAR_NONE,
"Позиция дхуд (Y)"),
g_WinCvars[DHUD_WIN_Y]
);
bind_pcvar_float(create_cvar(
"dhud_holdtime",
"5.0",
FCVAR_NONE,
"Время сообщения на экране"),
g_WinCvars[DHUD_HOLDTIME]
);
bind_pcvar_num(create_cvar(
"dhud_win_ct_r",
"80",
FCVAR_NONE,
"Цвет дхуд при победе КТ (Красный оттенок)"),
g_WinCvars[DHUD_WIN_CT_R]
);
bind_pcvar_num(create_cvar(
"dhud_win_ct_g",
"79",
FCVAR_NONE,
"Цвет дхуд при победе КТ (Зеленый оттенок)"),
g_WinCvars[DHUD_WIN_CT_G]
);
bind_pcvar_num(create_cvar(
"dhud_win_ct_b",
"208",
FCVAR_NONE,
"Цвет дхуд при победе КТ (Синий оттенок)"),
g_WinCvars[DHUD_WIN_CT_B]
);
bind_pcvar_num(create_cvar(
"dhud_win_tt_r",
"245",
FCVAR_NONE,
"Цвет дхуд при победе ТТ (Красный оттенок)"),
g_WinCvars[DHUD_WIN_TT_R]
);
bind_pcvar_num(create_cvar(
"dhud_win_tt_g",
"30",
FCVAR_NONE,
"Цвет дхуд при победе ТТ (Зеленый оттенок)"),
g_WinCvars[DHUD_WIN_TT_G]
);
bind_pcvar_num(create_cvar(
"dhud_win_tt_b",
"30",
FCVAR_NONE,
"Цвет дхуд при победе ТТ (Синий оттенок)"),
g_WinCvars[DHUD_WIN_TT_B]
);
AutoExecConfig(true, "DhudWinStatus");
}