Try this:
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <engine>
new CvarTimeRespawn, CsTeams:g_Team;
public plugin_init()
{
register_plugin( "Respawn", "0.14b", "G_often" )
CvarTimeRespawn = register_cvar( "respawn_time", "1.0" )
register_event( "DeathMsg", "EventDeathMsg", "a", "1>0" );
register_event( "TeamInfo", "PlayerJoinTeam", "a" )
}
public EventDeathMsg()
{
static id;
id = read_data( 2 )
g_Team = cs_get_user_team( id )
if( g_Team == CS_TEAM_UNASSIGNED || g_Team == CS_TEAM_SPECTATOR )
return PLUGIN_HANDLED;
set_task( get_pcvar_float( CvarTimeRespawn ), "RespawnPlayer", id )
return PLUGIN_CONTINUE;
}
public PlayerJoinTeam()
{
static id;
id = read_data( 1 )
g_Team = cs_get_user_team( id )
if( g_Team == CS_TEAM_UNASSIGNED || g_Team == CS_TEAM_SPECTATOR )
return PLUGIN_HANDLED;
set_task( get_pcvar_float( CvarTimeRespawn ), "RespawnPlayer", id )
return PLUGIN_CONTINUE;
}
public RespawnPlayer( id )
{
if( is_user_alive(id) )
return;
set_hudmessage( id, 225, 0, 0.05, 0.45, 0, 6.0, 6.0, 0.5, 0.15, 3 )
show_hudmessage(id,"[Respawned]")
client_print(id, print_console,"Respawned.")
entity_set_int(id, EV_INT_deadflag, DEAD_RESPAWNABLE)
entity_set_int(id, EV_INT_iuser1, 0)
call_think(id)
DispatchSpawn(id)
}
__________________