Someone joins late move to team 3

Is there a way, say after 60 seconds or if someone gets killed that if someone joins they will be moved to team_3?

Thanks! :slight_smile:

So on death you want them moved to team 3, but can only respawn after 60 seconds?

SERVERSIDE

[lua]function GM:PlayerDeath ( victim, weapon, killer )
victim:SetTeam( TEAM_3 )
victim._deathTime = CurTime( )
end

function GM:PlayerDeathThink( Player )
if ( CurTime( ) - Player._deathTime < 60 ) then
return false;
end

return true;

end[/lua]

I want it so, if someone joins late, they get moved to team_3

(I don’t have a round system in place, is there a way to do it without a round system, maybe a timer?

The initial base of what you’re asking for:
[lua]
hook.Add(“PlayerInitialSpawn”, “LateJoinSetup”, function(ply)
timer.Simple(60, function()
if IsValid(ply) and ply:Team() != 3 then
ply:SetTeam(3)
end
end)
end)

hook.Add(“PlayerDeath”, “PlayerToTeam3”, function(ply, infl, attacker)
ply:SetTeam(3)
end)
[/lua]

By the way, rephrase the OP’s sentence because to me it doesn’t make the slightest bit of sense.

The way I do it, is with PlayerInitialSpawn, set it to TEAM_SPECTATOR, or whichever team you want .

PlayerSpawn, if they are TeamSpectator, don’t spawn them by calling return; and call Player:Spectate( mode ) on them right before the return statement.

When you want them to join a team, set their team and call Player:UnSpectate( ) on them.

Also, on PlayerDeathThink return false if they’re not allowed to spawn.

All of that is done server-side. If you want to add additional features such as not allowing them to fly around, you can do a client-side CalcView call and have them look at a specific area while they’re in spectate mode.

It’d be easier with a round-system, because in a sense you’re emulating one by doing this. And because triggers are set up already so you can hook into them to respawn, etc.