GetTeamFromName: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
mNo edit summary |
||
Line 21: | Line 21: | ||
local redteam = getTeamFromName ( "Red" ) | local redteam = getTeamFromName ( "Red" ) | ||
if ( | if ( redteam ) then -- If it was found (not false) | ||
addPlayerToTeam ( source, redteam ) | addPlayerToTeam ( source, redteam ) | ||
end | end |
Revision as of 18:55, 17 August 2007
This function finds a team object by the team's 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' local redteam = getTeamFromName ( "Red" ) if ( redteam ) then -- If it was found (not false) addPlayerToTeam ( source, redteam ) 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