here it is.. but it crashes the server on map change.
Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>
public hook_TextMsg(msgid, msgdest, msgargs) {
new message[32]
get_msg_arg_string(2, message, 31) // Get text message
// If text message = "Game will restart in X seconds" then block the message
if (equal(message, "#Game_will_restart_in"))
return PLUGIN_HANDLED // Blocks message
return PLUGIN_CONTINUE // Lets other TextMsg messages go through
}
public drestart(param[])
set_cvar_string("sv_restart",param)
public admin_rr(id, level, cid) {
if (!cmd_access(id, level, cid, 3))
return PLUGIN_HANDLED
new sdelay[4], stimes[4]
read_argv(1,stimes,3)
read_argv(2,sdelay,3)
new delay = str_to_num(sdelay)
new times = str_to_num(stimes)
for(new a = times;a > 0;--a)
set_task( float(delay * a) + 1.0 , "drestart", 0, sdelay, 4)
// console_print(id,"The Game will restart %d times with a %d sec. delay between restarts",times,delay)
set_hudmessage(245, 245,245, -1.0, 0.4, 0, 4.0, 20.0, 2.0, 2.0, 1)
show_hudmessage(0,"RESTART!")
set_hudmessage(245, 10,10, -1.0, 0.43, 0, 4.0, 20.0, 2.0, 2.0, 2)
show_hudmessage(0,"LIVE! LIVE! LIVE!")
set_hudmessage(245, 10,10, -1.0, 0.46, 0, 4.0, 20.0, 2.0, 2.0, 3)
show_hudmessage(0,"GOOD LUCK, HAVE FUN!")
return PLUGIN_HANDLED
}
public plugin_init() {
register_plugin("Admin RestartRound","1.0.0","mercury")
register_concmd("amx_restart","admin_rr",ADMIN_LEVEL_A,"<restart times> <delay>")
register_message(get_user_msgid("TextMsg"), "hook_TextMsg") // Hook TextMsg message to function
return PLUGIN_CONTINUE
}