new cRound, cvar_rounds, cvar_time, cvar_notice, cvar_message, cvar_message_color, cvar_hud, cvar_hud_color, cvar_sound, cvar_restart, hudsync, counter
/*START - From colorchat.inc by Numb */
/*END - From colorchat.inc by Numb */
register_plugin("Auto Restart In X Round", ARIXR_VERSION, "Kriminal")
register_logevent("roundStart", 2, "1=Round_Start")
cvar_rounds = register_cvar("amx_restart_round", "2")
cvar_time = register_cvar("amx_restart_time", "10.0")
cvar_notice = register_cvar("amx_restart_notice", "3")
cvar_message = register_cvar("amx_restart_message", "That's the %round% round!Restarting...")
cvar_message_color = register_cvar("amx_restart_message_color", "4")
cvar_hud = register_cvar("amx_restart_hud", "%seconds% seconds until restart!")
cvar_hud_color = register_cvar("amx_restart_hud_color", "0 255 0")
cvar_sound = register_cvar("amx_restart_sound", "1")
cvar_restart = get_cvar_pointer("sv_restart")
register_cvar("arixr_version", ARIXR_VERSION, FCVAR_SERVER | FCVAR_SPONLY)
hudsync = CreateHudSyncObj()
new rounds = get_pcvar_num(cvar_rounds)
switch(get_pcvar_num(cvar_notice)) {
case 0: set_task(get_pcvar_float(cvar_time), "restartRound", 123457)
set_task(get_pcvar_float(cvar_time), "show_chat_message", 123458)
set_task(get_pcvar_float(cvar_time), "restartRound", 123457)
set_task(1.0, "hudTimer", 123456, _, _, "a", get_pcvar_num(cvar_time))
set_task(get_pcvar_float(cvar_time), "restartRound", 123457)
set_task(1.0, "hudTimer", 123456, _, _, "a", get_pcvar_num(cvar_time))
set_task(get_pcvar_float(cvar_time), "restartRound", 123457)
set_task(get_pcvar_float(cvar_time), "show_chat_message", 123458)
default: set_task(get_pcvar_float(cvar_time), "restartRound", 123457)
if(get_pcvar_num(cvar_sound))
set_task(1.0, "spkSound", 123456, _, _, "a", get_pcvar_num(cvar_time))
public show_chat_message() {
if(get_playersnum(1) == 0)
new message[190], rounds[10]
get_pcvar_string(cvar_message, message, charsmax(message))
format(rounds, charsmax(rounds), "%d", cRound)
replace_all(message, charsmax(message), "%round%", rounds)
switch(get_pcvar_num(cvar_message_color)) {
case 1: ColorChat(0, GREEN, "[%s] %s", prefix, message)
case 2: ColorChat(0, RED, "[%s] %s", prefix, message)
case 3: ColorChat(0, GREY, "[%s] %s", prefix, message)
case 4: ColorChat(0, BLUE, "[%s] %s", prefix, message)
case 5: ColorChat(0, NORMAL, "[%s] %s", prefix, message)
case 6: ColorChat(0, TEAM_COLOR, "[%s] %s", prefix, message)
default: ColorChat(0, NORMAL, "[%s] %s", prefix, message)
if(get_playersnum(1) == 0)
new hud[190], rounds[10], seconds[10], red, green, blue
get_pcvar_string(cvar_hud, hud, charsmax(hud))
format(rounds, charsmax(rounds), "%d", cRound)
format(seconds, charsmax(seconds), "%d", get_pcvar_num(cvar_time) - counter)
get_hud_color(red, green, blue)
replace_all(hud, charsmax(hud), "%round%", rounds)
replace_all(hud, charsmax(hud), "%seconds%", seconds)
replace_all(hud, charsmax(hud), "/n", "^n")
set_hudmessage(red, green, blue, 0.05, 0.60, 0, 0.01, 1.0, 0.0, 0.0, -1)
ShowSyncHudMsg(0, hudsync, hud)
if(get_playersnum(1) == 0)
num_to_word(get_pcvar_num(cvar_time) - counter, sound, charsmax(sound))
client_cmd(0, "spk ^"vox/%s^"", sound)
set_pcvar_num(cvar_restart, 2)
get_hud_color(&r, &g, &b) {
static red[5], green[5], blue[5]
get_pcvar_string(cvar_hud_color, color, charsmax(color))
parse(color, red, charsmax(red), green, charsmax(green), blue, charsmax(blue))
/*START - From colorchat.inc by Numb */
ColorChat(id, Color:type, const msg[], {Float, Sql, Result,_}:...) {
case NORMAL: message[0] = 0x01
case GREEN: message[0] = 0x04
default: message[0] = 0x03
vformat(message[1], 251, msg, 4)
new team, ColorChange, index, MSG_Type
team = get_user_team(index)
ColorChange = ColorSelection(index, MSG_Type, type)
ShowColorMessage(index, MSG_Type, message)
Team_Info(index, MSG_Type, TeamName[team])
ShowColorMessage(id, type, message[]) {
static get_user_msgid_saytext
get_user_msgid_saytext = get_user_msgid("SayText")
message_begin(type, get_user_msgid_saytext, _, id)
Team_Info(id, type, team[]) {
static bool:teaminfo_used
static get_user_msgid_teaminfo
get_user_msgid_teaminfo = get_user_msgid("TeamInfo")
message_begin(type, get_user_msgid_teaminfo, _, id)
ColorSelection(index, type, Color:Type) {
case RED: return Team_Info(index, type, TeamName[1])
case BLUE: return Team_Info(index, type, TeamName[2])
case GREY: return Team_Info(index, type, TeamName[0])
while(i <= get_maxplayers()) {
if(is_user_connected(++i))