I've taken codes from
here
I trying to make players respawn when they are late joined just like csdm but, didn't work.
PHP Code:
new g_iRespawnDelay
public plugin_init( )
{
register_event( "DeathMsg", "Death_Message", "a" )
g_iRespawnDelay = register_cvar( "Respawn", "5.0" )
}
public Respawn_Player( id )
{
if ( !is_user_connected( id ) || is_user_alive( id ) || cs_get_user_team( id ) == CS_TEAM_SPECTATOR )
return;
if ( !is_user_alive( id ) && cs_get_user_team( id ) == CS_TEAM_T || CS_TEAM_CT )
{
set_pev( id, pev_deadflag, DEAD_RESPAWNABLE )
dllfunc( DLLFunc_Think, id )
if ( is_user_bot( id ) && pev( id, pev_deadflag ) == DEAD_RESPAWNABLE )
{
dllfunc( DLLFunc_Spawn, id )
}
}
}
public Death_Message( )
{
new id = read_data( 2 )
set_task( get_pcvar_float( g_iRespawnDelay ), "Respawn_Player", id )
}