#include <amxmodx>
#define AUTORR_TIME 35 // Auto Restart Time
#define AUTORR_LIMIT 1 // Количество рестартов
#define TASK_ID_ARR_COUNTDOWN 8854
new message[128]
new g_arr_round
new g_arr_HudSync
new g_arr_countdown
public plugin_init()
{
register_plugin("AutoRestart", "1.0", "neygomon")
register_event("ResetHUD", "event_reset_hud", "be")
register_event("TextMsg", "event_start_game", "a", "2=#Game_Commencing")
register_event("HLTV", "event_start_round", "a", "1=0", "2=0")
g_arr_HudSync = CreateHudSyncObj()
}
public task_arr_countdown()
{
if(g_arr_countdown--)
{
format(message, sizeof(message) - 1, "Рестарт раунда через %i секунд!", g_arr_countdown)
if(g_arr_countdown < AUTORR_LIMIT) set_cvar_num("sv_restart", 1)
set_hudmessage(220, 160, 0, -1.0, 0.8, 0, 0.0, 1.03, 0.0, 0.0, 5)
show_hudmsg(0)
set_task(1.0, "task_arr_countdown", TASK_ID_ARR_COUNTDOWN)
}
else
{
format(message, sizeof(message) - 1, "LIVE! LIVE! LIVE!^nУдачи и весёлой игры!")
set_hudmessage(100, 200, 0, -1.0, 0.8, 0, 0.0, 3.0, 0.0, 2.0, 5)
set_task(1.0, "task_arr_countlast")
}
}
public task_arr_countlast()
{
if(task_exists(TASK_ID_ARR_COUNTDOWN)) remove_task(TASK_ID_ARR_COUNTDOWN)
show_hudmsg(0)
}
public event_start_game() g_arr_round = 0
public event_start_round()
{
if(++g_arr_round == 1)
{
if(task_exists(TASK_ID_ARR_COUNTDOWN)) return
g_arr_countdown = AUTORR_TIME
set_task(1.0, "task_arr_countdown", TASK_ID_ARR_COUNTDOWN)
}
return
}
public event_reset_hud(id)
{
if(task_exists(TASK_ID_ARR_COUNTDOWN)) show_hudmsg(id)
}
show_hudmsg(id)
{
ShowSyncHudMsg(id, g_arr_HudSync, "%s", message)
}
public plugin_end()
{
if(task_exists(TASK_ID_ARR_COUNTDOWN)) remove_task(TASK_ID_ARR_COUNTDOWN)
}