Can you not just use this:
https://forums.alliedmods.net/showth...ht=AutoRespawn
Set the delay to whatever you want and then your team move can be its own thing, or just add your code in to this... Also someone flagged it respawns spectators so probably add something to check the team is >=2 to the spawn bit:
PHP Code:
public Action:RespawnClient( Handle:timer, any:client )
{
if( GetConVarBool(sm_ar_enable) )
{
if ( IsValidEntity(client) && IsClientInGame(client) && IsClientObserver(client) && !IsPlayerAlive(client) )
{
if ( GetConVarBool(ar_dissolve_ragdolls) )
{
new ragdoll = GetEntPropEnt(client, Prop_Send, "m_hRagdoll");
if ( ragdoll > 0 )
{
new ent = CreateEntityByName("env_entity_dissolver");
if ( ent > 0 )
{
new String:dissolvename[32];
Format(dissolvename, sizeof(dissolvename), "dis_%d", client);
DispatchKeyValue(ragdoll, "targetname", dissolvename);
DispatchKeyValue(ent, "dissolvetype", "0");
DispatchKeyValue(ent, "target", dissolvename);
AcceptEntityInput(ent, "Dissolve");
AcceptEntityInput(ent, "kill");
}
}
}
CS_RespawnPlayer(client);
}
}
}
Something like this:
PHP Code:
new team = GetClientTeam(client);
{
if(team >= 2)
{
Withing the rest, i'm a beginner though so i'm sure the panda can tell me to shut up and stop being a dumb ass ;). Basically why code up something that already exists.