GetTeamFromName: Difference between revisions
Jump to navigation
Jump to search
Line 14: | Line 14: | ||
==Example== | ==Example== | ||
This example | This example joins a team named "Red", if it is found. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function joinRedTeam ( source ) | function joinRedTeam ( source ) |
Revision as of 03:45, 2 August 2007
This function is for finding a team object from its name.
Syntax
team getTeamFromName ( string teamName )
Required Arguments
- teamName: A string determining the name of the team you wish to find.
Returns
Returns the team object if it was found, 'false' otherwise.
Example
This example joins a team named "Red", if it is found.
function joinRedTeam ( source ) -- Try to find the team named 'Red' team = getTeamFromName ( "Red" ) if ( team ) then -- If it was found (not false) addPlayerToTeam ( source, team ) end end --Add console command to join the team when 'joinTeam' is typed. addCommandHandler ( "joinTeam", joinRedTeam )
See Also
- countPlayersInTeam
- getPlayerTeam
- getPlayersInTeam
- getTeamColor
- getTeamFriendlyFire
- getTeamFromName
- getTeamName