team.Joinable

From GMod Wiki

Jump to: navigation, search
Function
Syntax team.Joinable( Integer team index )
Where is this used?
Description:
Returns if a team is joinable or not.
Returns: Boolean
Part of Library: Team
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Team.Joinable]Team.Joinable [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionAt our first spawn, if we can join team 1 we join team 1, otherwise we join team 2.
Used onNewerServer.png
Code
 
function TeamControl( ply )
    if team.Joinable(1) then // if we can join team 1 then
        ply:SetTeam(1)       // join it
    else                     // otherwise
        ply:SetTeam(2)       // join team 2
    end
end
hook.Add("PlayerInitialSpawn","Team Control",TeamControl)
 
OutputN/A


See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox