#include amxmodx
#define SOUND // Закомментировать, если не нужна озвучка в конце раунда
#define SCREENFADE // Закомментировать, если не нужно тонирование экрана в конце карты
new Trie:tMsgs
new msgcvar
new gmsgSendAudio, g_iMessageIndex;
new Float:g_flDefusedTime;
public plugin_precache ()
{
precache_sound("radio/bombdef.wav");
#if defined SOUND
precache_sound("radio/wm/ctwin.wav");
precache_sound("radio/wm/terwin.wav");
precache_sound("radio/wm/rounddraw.wav");
#endif
}
public plugin_init()
{
register_plugin("Win Messages", "1.2", "neygomon");
register_message(get_user_msgid("TextMsg"), "MsgTextMsg");
gmsgSendAudio = get_user_msgid("SendAudio");
msgcvar = register_cvar("win_msg", "1")
tMsgs = TrieCreate();
TrieSetCell(tMsgs, "#Terrorists_Win", 1);
TrieSetCell(tMsgs, "#CTs_Win", 2);
TrieSetCell(tMsgs, "#Round_Draw", 3);
TrieSetCell(tMsgs, "#Game_Commencing", 4);
TrieSetCell(tMsgs, "#Bomb_Planted", 5);
TrieSetCell(tMsgs, "#Bomb_Defused", 6);
#if defined SOUND
register_event("SendAudio", "t_win", "a", "2&%!MRAD_terwin")
register_event("SendAudio", "ct_win", "a", "2&%!MRAD_ctwin")
register_event("SendAudio", "draw", "a", "2&%!MRAD_rounddraw")
#endif
register_logevent("EventBombDefused", 3, "2=Defused_The_Bomb");
#if defined SCREENFADE
register_event("HLTV","RoundStart","a","1=0","2=0")
#endif
}
#if defined SCREENFADE
public RoundStart()
{
ScreenFade(4);
}
#endif
public plugin_end()
TrieDestroy(tMsgs);
public MsgTextMsg(MsgId, MsgDest, MsgReceiver)
{
if(MsgReceiver)
return PLUGIN_CONTINUE;
static num, szMsg[20];
get_msg_arg_string(2, szMsg, charsmax(szMsg));
return TrieGetCell(tMsgs, szMsg, num) ? ShowHud(num) : PLUGIN_CONTINUE;
}
public EventBombDefused()
{
g_flDefusedTime = get_gametime();
if(!g_iMessageIndex)
g_iMessageIndex = register_message(gmsgSendAudio, "HookSendAudio");
}
public HookSendAudio( iMsgId, iMsgDest, iMsgEnt )
{
if(get_gametime() > g_flDefusedTime + 0.1)
{
unregister_message(gmsgSendAudio, g_iMessageIndex);
g_iMessageIndex = 0;
return PLUGIN_CONTINUE;
}
new szAudioString[17];
get_msg_arg_string(2, szAudioString, charsmax(szAudioString));
if(strcmp(szAudioString, "%!MRAD_ctwin") == 0)
#if defined SOUND
client_cmd(0,"stopsound; spk radio/wm/ctwin");
#else
client_cmd(0,"stopsound; spk radio/bombdef");
#endif
else
return PLUGIN_CONTINUE;
}
ShowHud(const Type)
{
static szMessage[96];
switch(get_pcvar_num(msgcvar))
{
case 1:
{
switch(Type)
{
case 1: client_print(0, print_center, "Команда Террористов победила!");
case 2: client_print(0, print_center, "Команда Контр-Террористов победила!");
case 3: client_print(0, print_center, "А у нас то ничья...");
case 4: client_print(0, print_center, "Игра началась");
case 5: client_print(0, print_center, "Бомба установлена");
case 6: client_print(0, print_center, "Бомба разминирована");
}
}
case 2:
{
switch(Type)
{
case 1:
{
formatex(szMessage, charsmax(szMessage), "Команда Террористов победила!");
set_dhudmessage(200, 0, 0, -1.0, 0.3, 0, 5.0, 5.0);
}
case 2:
{
formatex(szMessage, charsmax(szMessage), "Команда Контр-Террористов победила!");
set_dhudmessage(0, 0, 200, -1.0, 0.3, 0, 5.0, 5.0);
}
case 3:
{
formatex(szMessage, charsmax(szMessage), "А у нас то ничья...");
set_dhudmessage(240, 240, 240, -1.0, 0.3, 0, 5.0, 5.0);
}
case 4:
{
formatex(szMessage, charsmax(szMessage), "Игра началась");
set_dhudmessage(80, 125, 42, -1.0, 0.3, 0, 5.0, 5.0);
}
case 5:
{
formatex(szMessage, charsmax(szMessage), "Бомба установлена");
set_dhudmessage(255, 244, 79, -1.0, 0.3, 0, 5.0, 5.0);
}
case 6:
{
formatex(szMessage, charsmax(szMessage), "Бомба разминирована");
set_dhudmessage(108, 105, 96, -1.0, 0.3, 0, 5.0, 5.0);
}
}
ScreenFade(1);
}
}
show_dhudmessage(0, szMessage);
return PLUGIN_HANDLED;
}
#if defined SOUND
public t_win(id) client_cmd(0,"stopsound; spk radio/wm/terwin");
public ct_win(id) client_cmd(0,"stopsound; spk radio/wm/ctwin.wav");
public draw(id) client_cmd(0,"stopsound; spk radio/wm/rounddraw");
#endif
public ScreenFade(fade)
{
new flags;
new time = (0 <= fade <= 1) ? 4096 : 1;
new hold = (0 <= fade <= 1) ? 1024 : 1;
static mScreenFade; if(!mScreenFade) mScreenFade = get_user_msgid("ScreenFade");
switch(fade)
{
case 0:
{
flags = 2;
set_msg_block(mScreenFade, BLOCK_NOT);
}
case 1:
{
flags = 1;
set_task(1.0, "ScreenFade", 2);
}
case 2:
{
flags = 4;
set_msg_block(mScreenFade, BLOCK_SET);
}
}
message_begin(MSG_ALL, mScreenFade);
write_short(time);
write_short(hold);
write_short(flags);
write_byte(0);
write_byte(0);
write_byte(0);
write_byte(255);
message_end();
}
СпасибоAmyr, а как насчет поискать самому?
1 Мар 2022Код:#include amxmodx #define SOUND // Закомментировать, если не нужна озвучка в конце раунда #define SCREENFADE // Закомментировать, если не нужно тонирование экрана в конце карты new Trie:tMsgs new msgcvar new gmsgSendAudio, g_iMessageIndex; new Float:g_flDefusedTime; public plugin_precache () { precache_sound("radio/bombdef.wav"); #if defined SOUND precache_sound("radio/wm/ctwin.wav"); precache_sound("radio/wm/terwin.wav"); precache_sound("radio/wm/rounddraw.wav"); #endif } public plugin_init() { register_plugin("Win Messages", "1.2", "neygomon"); register_message(get_user_msgid("TextMsg"), "MsgTextMsg"); gmsgSendAudio = get_user_msgid("SendAudio"); msgcvar = register_cvar("win_msg", "1") tMsgs = TrieCreate(); TrieSetCell(tMsgs, "#Terrorists_Win", 1); TrieSetCell(tMsgs, "#CTs_Win", 2); TrieSetCell(tMsgs, "#Round_Draw", 3); TrieSetCell(tMsgs, "#Game_Commencing", 4); TrieSetCell(tMsgs, "#Bomb_Planted", 5); TrieSetCell(tMsgs, "#Bomb_Defused", 6); #if defined SOUND register_event("SendAudio", "t_win", "a", "2&%!MRAD_terwin") register_event("SendAudio", "ct_win", "a", "2&%!MRAD_ctwin") register_event("SendAudio", "draw", "a", "2&%!MRAD_rounddraw") #endif register_logevent("EventBombDefused", 3, "2=Defused_The_Bomb"); #if defined SCREENFADE register_event("HLTV","RoundStart","a","1=0","2=0") #endif } #if defined SCREENFADE public RoundStart() { ScreenFade(4); } #endif public plugin_end() TrieDestroy(tMsgs); public MsgTextMsg(MsgId, MsgDest, MsgReceiver) { if(MsgReceiver) return PLUGIN_CONTINUE; static num, szMsg[20]; get_msg_arg_string(2, szMsg, charsmax(szMsg)); return TrieGetCell(tMsgs, szMsg, num) ? ShowHud(num) : PLUGIN_CONTINUE; } public EventBombDefused() { g_flDefusedTime = get_gametime(); if(!g_iMessageIndex) g_iMessageIndex = register_message(gmsgSendAudio, "HookSendAudio"); } public HookSendAudio( iMsgId, iMsgDest, iMsgEnt ) { if(get_gametime() > g_flDefusedTime + 0.1) { unregister_message(gmsgSendAudio, g_iMessageIndex); g_iMessageIndex = 0; return PLUGIN_CONTINUE; } new szAudioString[17]; get_msg_arg_string(2, szAudioString, charsmax(szAudioString)); if(strcmp(szAudioString, "%!MRAD_ctwin") == 0) #if defined SOUND client_cmd(0,"stopsound; spk radio/wm/ctwin"); #else client_cmd(0,"stopsound; spk radio/bombdef"); #endif else return PLUGIN_CONTINUE; } ShowHud(const Type) { static szMessage[96]; switch(get_pcvar_num(msgcvar)) { case 1: { switch(Type) { case 1: client_print(0, print_center, "Команда Террористов победила!"); case 2: client_print(0, print_center, "Команда Контр-Террористов победила!"); case 3: client_print(0, print_center, "А у нас то ничья..."); case 4: client_print(0, print_center, "Игра началась"); case 5: client_print(0, print_center, "Бомба установлена"); case 6: client_print(0, print_center, "Бомба разминирована"); } } case 2: { switch(Type) { case 1: { formatex(szMessage, charsmax(szMessage), "Команда Террористов победила!"); set_dhudmessage(200, 0, 0, -1.0, 0.3, 0, 5.0, 5.0); } case 2: { formatex(szMessage, charsmax(szMessage), "Команда Контр-Террористов победила!"); set_dhudmessage(0, 0, 200, -1.0, 0.3, 0, 5.0, 5.0); } case 3: { formatex(szMessage, charsmax(szMessage), "А у нас то ничья..."); set_dhudmessage(240, 240, 240, -1.0, 0.3, 0, 5.0, 5.0); } case 4: { formatex(szMessage, charsmax(szMessage), "Игра началась"); set_dhudmessage(80, 125, 42, -1.0, 0.3, 0, 5.0, 5.0); } case 5: { formatex(szMessage, charsmax(szMessage), "Бомба установлена"); set_dhudmessage(255, 244, 79, -1.0, 0.3, 0, 5.0, 5.0); } case 6: { formatex(szMessage, charsmax(szMessage), "Бомба разминирована"); set_dhudmessage(108, 105, 96, -1.0, 0.3, 0, 5.0, 5.0); } } ScreenFade(1); } } show_dhudmessage(0, szMessage); return PLUGIN_HANDLED; } #if defined SOUND public t_win(id) client_cmd(0,"stopsound; spk radio/wm/terwin"); public ct_win(id) client_cmd(0,"stopsound; spk radio/wm/ctwin.wav"); public draw(id) client_cmd(0,"stopsound; spk radio/wm/rounddraw"); #endif public ScreenFade(fade) { new flags; new time = (0 <= fade <= 1) ? 4096 : 1; new hold = (0 <= fade <= 1) ? 1024 : 1; static mScreenFade; if(!mScreenFade) mScreenFade = get_user_msgid("ScreenFade"); switch(fade) { case 0: { flags = 2; set_msg_block(mScreenFade, BLOCK_NOT); } case 1: { flags = 1; set_task(1.0, "ScreenFade", 2); } case 2: { flags = 4; set_msg_block(mScreenFade, BLOCK_SET); } } message_begin(MSG_ALL, mScreenFade); write_short(time); write_short(hold); write_short(flags); write_byte(0); write_byte(0); write_byte(0); write_byte(255); message_end(); }