
/* AMX_MOD script.
* ---------------------------------------------------------------------------
*
* Plugin: amx_commoncommands.amx
* Author: Toverand
* Contact: Toverand@hotmail.com
* Date: November 12, 2002
* Information:
*	- Provides a reusable structure to run any number of commands
*	- Commands are used as if you are using rcon without having to type rcon(ex. mp_timelimit 30 rather than "rcon mp_timelimit 30" or "amx_timelimit 30")
*	- Comes with some common CS Commands registered...but they can easily be changed to any MOD's CVARS
*
* ---------------------------------------------------------------------------
*/

#include <amxmod>

public amx_commands(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 == 2) {
		new command[60]
		new variable[5]
		read_argv(0,command,60)
		read_argv(1,variable,5)
		set_cvar_num(command,str_to_num(variable))
		client_print(id,print_console,"[AMX] %s has been set to %i",command,str_to_num(variable))
	}else if (argc == 1) {
		new command[60]
		new variable[5]
		read_argv(0,command,60)
		get_cvar_string(command,variable,5)
		client_print(id,print_console,"[AMX] %s is set to %s",command,variable)
	}else {
		client_print(id,print_console,"[AMX] Invalid command usage, re-enter command")
	}
	return PLUGIN_HANDLED
}


public plugin_init()
{
	register_plugin("Common Commands","v1.0","Toverand")
	register_clcmd("sv_restart","amx_commands",ADMIN_LEVEL_A,"sv_restart <#seconds>")
	register_clcmd("sv_restartround","amx_commands",ADMIN_LEVEL_A,"sv_restartround <#seconds>")
	register_clcmd("sv_gravity","amx_commands",ADMIN_LEVEL_A,"sv_gravity <#> (default=800)")
	register_clcmd("sv_airaccelerate","amx_commands",ADMIN_LEVEL_A,"sv_airaccelerate <#> (default=10)")
	register_clcmd("mp_timelimit","amx_commands",ADMIN_LEVEL_A,"mp_timelimit <#minutes>")
	register_clcmd("mp_roundtime","amx_commands",ADMIN_LEVEL_A,"mp_roundtime <#minutes>")
	register_clcmd("mp_buytime","amx_commands",ADMIN_LEVEL_A,"mp_buytime <#minutes> (for seconds use .5 etc.)")
	register_clcmd("mp_freezetime","amx_commands",ADMIN_LEVEL_A,"mp_freezetime <#seconds>")
	register_clcmd("mp_c4timer","amx_commands",ADMIN_LEVEL_A,"mp_c4timer <#seconds> [CS Command]")
	register_clcmd("mp_maxrounds","amx_commands",ADMIN_LEVEL_A,"mp_maxrounds <#rounds>")
	register_clcmd("mp_forcecamera","amx_commands",ADMIN_LEVEL_A,"mp_forcecamera <2-team only/1-any player/0-off>")
	register_clcmd("mp_forcechasecam","amx_commands",ADMIN_LEVEL_A,"mp_forcechasecam <2-team only/1-any player/0-off>")
	register_clcmd("mp_fadetoblack","amx_commands",ADMIN_LEVEL_A,"mp_fadetoblack <1-on/0-off> [CS Command]")
	register_clcmd("mp_friendlyfire","amx_commands",ADMIN_LEVEL_A,"mp_friendlyfire <1-on/0-off>")
	register_clcmd("mp_limitteams","amx_commands",ADMIN_LEVEL_A,"mp_limitteams <# of players 1 team can have over the other/0-off>")
	register_clcmd("mp_tkpunish","amx_commands",ADMIN_LEVEL_A,"mp_tkpunish <1-on/0-off>")
	register_clcmd("mp_hostagepenalty","amx_commands",ADMIN_LEVEL_A,"mp_hostagepenalty <# of hostages killed before kicking player/0-off> [CS Command]")
	register_clcmd("allow_spectators","amx_commands",ADMIN_LEVEL_A,"allow_spectators <# of specators to allow>")
	return PLUGIN_CONTINUE
}

