/* AMXMOD script.
*
* (c) Copyright 2000-2002, f117bomb
* This file is provided as is (no warranties).
*
*/

#include <amxmod>

/*
* amx_restartround < times to restart > < delay before each restart >
*
*/


public admin_restartround(id)
{
	if (!(get_user_flags(id)&ADMIN_LEVEL_A)){
		client_print(id,print_console,"[AMX] You have no access to that command")
		return PLUGIN_HANDLED
	}
	new argc = read_argc()
	if (argc < 3) {
		client_print(id,print_console,"[AMX] Usage:  amx_restartround < times to restart > < delay before each restart >")
		return PLUGIN_HANDLED
	}
	else {
		new sdelay[12], stimes[12]
		new delay, times
		new Float:timer
		read_argv(1,stimes,12)
		read_argv(2,sdelay,12)		
		delay = str_to_num(sdelay)
		times = str_to_num(stimes)
		client_print(id,print_console,"[AMX] The Game will restart %i times with a %i sec delay between restarts.",times,delay)
		while( times > 0 )
		{	
			timer = delay * times + 1.0	
			set_task(timer, "restart", 0, sdelay, 12)
			times -= 1
		}		
	}
	return PLUGIN_HANDLED
}

public restart(delay[])
{
	set_cvar_num("sv_restartround",str_to_num(delay))
}

public plugin_init()
{
	register_plugin("Admin RestartRound","0.6","f117bomb")
	register_clcmd("amx_restartround","admin_restartround",ADMIN_LEVEL_A,"amx_restartround < times to restart > < delay before each restart >")
	return PLUGIN_CONTINUE
}

