/* AMX Mod script. 
* 
* (c) Copyright 2002-2003, f117bomb 
* This file is provided as is (no warranties). 
* 
*/ 

#include <amxmod> 
#include <cstrike>

/* 
* 
* Set Cvar 'amx_respawn' 1 or 0 
* 
*/ 
public TeamSelect(id)
{
	if (get_cvar_num("amx_respawn") == 1)   {
		new sId[2]
		sId[0] = id
		set_task(10.0,"respawn",0,sId,2)
	}
	return PLUGIN_CONTINUE
}

public death_msg() 
{    
	if (get_cvar_num("amx_respawn") == 1)   { 
		new vIndex = read_data(2) 
		new svIndex[2]
		svIndex[0] = vIndex
		set_task(0.5,"respawn",0,svIndex,2) 
	} 
	return PLUGIN_CONTINUE 
} 

public respawn(svIndex[]) 
{ 
	new vIndex = svIndex[0] 
	if(cs_get_user_team(vIndex) == CS_TEAM_SPECTATOR || is_user_alive(vIndex)) 
		return PLUGIN_CONTINUE 
	user_spawn(vIndex) 
	
	return PLUGIN_CONTINUE    
} 

public plugin_init() 
{ 
   	register_plugin("無限生命","0.9.4","NBjs GhTe") 
	register_event("DeathMsg","death_msg","a") 
	register_event("ShowMenu","TeamSelect","b","4&Team_Select")
	register_event("VGUIMenu","TeamSelect","b","1=2")
	register_cvar("amx_respawn","0") 
	
	return PLUGIN_CONTINUE 
}  