#include <amxmodx>
#include <fakemeta>

new cvar_lights

public plugin_init()
{
	register_plugin("Lightning", "1.0", "Cheap_Suit")
	cvar_lights = register_cvar("bh_lights", "c")
	set_task(3.0, "lightning")
}

public lights()
{
	static light[2]
	get_pcvar_string(cvar_lights, light, 1)
	engfunc(EngFunc_LightStyle, 0, light)
}

public lightning()
{
	static light[2]
	get_pcvar_string(cvar_lights, light, 1)
	engfunc(EngFunc_LightStyle, 0, light)

	set_task(random_float(20.0,30.0), "thunder")
}

public thunder()
{
	engfunc(EngFunc_LightStyle, 0, "v")
	client_cmd(0,"speak ambience/thunder_clap.wav")
	set_task(3.0,"lightning")
}