/* AMX Mod script.
*
* Spawn Protection
*  by JustinHoMi and EJ
*
*/

#include <amxmod>

public protect_on(id)
{
	new curmap[32]
	get_mapname(curmap,32)

	new Float:ptime = get_cvar_float("amx_spawn_protect_time")

	if (get_cvar_num("amx_spawn_protect"))
	{
		set_user_health(id,99940)
		new param[1]
		param[0] = id
		set_task(ptime,"protect_off",0,param,1)
	}

	return PLUGIN_CONTINUE
}


public protect_off(param[])
{
	set_user_health(param[0],100)
    return PLUGIN_CONTINUE
}


public plugin_init() {
	register_plugin("Spawn Protection","0.51","JustinHoMi")
	register_event("ResetHUD", "protect_on", "be")
	register_cvar("amx_spawn_protect","0")
	register_cvar("amx_spawn_protect_time","5.0")
	server_cmd("mp_freezetime 0")
	return PLUGIN_CONTINUE
}
