Back to TPG

TPG.PlayerTeams.CanJoin

S🏷️ Playerteams

Part of TPG namespace

TPG.PlayerTeams.CanJoin(ply, targetTeam)
View on GitHub|gamemode/player/sv_teams.lua:89-111
📋 Has LDoc👁️ 0 viewsUpdated 1 month ago

Description

Would ply joining targetTeam leave the teams unbalanced? Spectator is always allowed. Otherwise counts both teams, subtracts ply from their current team if they are already on one (so switching teams doesn't double-count them), and rejects a join that would make the target team strictly larger than the other.

Parameters

NameTypeDescription
plyPlayer
targetTeamnumberTEAM_GREEN, TEAM_RED or TEAM_UNASSIGNED.

Returns

TypeDescription
boolean

Examples

No examples available.

Used In

No usages found in the codebase.