Arruma esse plugin aqui para mim.
Spoiler :
Código:
#include <amxmodx>
new bool:g_restarted, cvar_rr_time, cvar_rr_hud_color[3], Seconds, R, G, B
new g_MaxPlayers // max server players
new g_msgSayText // say text message
new bool:g_connected[33] // connected
public plugin_init()
{
register_plugin("Auto Restart", "1.1", "9 3 () |2 9 ! /<")
//register_event("TextMsg", "event_game_commencing", "a", "1=#Game_Commencing")
register_logevent("event_game_commencing", 2, "0=World triggered", "1=Game_Commencing")
register_dictionary("restart.txt")
register_concmd("say /restart", "concmd_restart")
g_MaxPlayers = get_maxplayers()
g_msgSayText = get_user_msgid("SayText")
cvar_rr_time = register_cvar("mp_rr_time", "20")
cvar_rr_hud_color[0] = register_cvar("mp_rr_hud_color_R", "255")
cvar_rr_hud_color[1] = register_cvar("mp_rr_hud_color_G", "")
cvar_rr_hud_color[2] = register_cvar("mp_rr_hud_color_B", "")
R = get_pcvar_num(cvar_rr_hud_color[0])
G = get_pcvar_num(cvar_rr_hud_color[1])
B = get_pcvar_num(cvar_rr_hud_color[2])
g_restarted = false
}
public event_game_commencing()
{
log_amx("event_game_commencing trigger!")
if (g_restarted)
return;
g_restarted = true
Seconds = get_pcvar_num(cvar_rr_time)
CountDown()
}
public client_putinserver(id)
g_connected[id] = true
public client_disconnect(id)
g_connected[id] = false
public concmd_restart(id)
{
if (get_user_flags(id) & ADMIN_MAP)
{
static name[32], i
if (task_exists())
remove_task()
get_user_name(id, name, charsmax(name))
Seconds = 0
CountDown()
for (i = 1; i <= g_MaxPlayers; i++)
colored_print(i, id, "^1ADMIN^3 %s^1:^4 Deu Restart", name)
}
}
public CountDown()
{
Seconds--
if (Seconds > 0)
{
set_hudmessage(R, G, B, -2.0, -1.0, 1, 2.0, 2.0)
show_hudmessage(0, "%L^n%L", LANG_PLAYER, "MPR_WAIT", LANG_PLAYER, "MPR_COUNTDOWN", Seconds)
set_task(1.0, "CountDown")
}
else
{
server_cmd("sv_restart 1")
remove_task()
}
}
colored_print(tg, sd, const message[], any:...)
{
if (!g_connected[tg])
return;
static buffer[192]
// Format message for player
vformat(buffer, charsmax(buffer), message, 4)
message_begin(MSG_ONE_UNRELIABLE, g_msgSayText, _, tg)
write_byte(sd)
write_string(buffer)
message_end()
}