GetTeamFromName: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
mNo edit summary |
||
Line 22: | Line 22: | ||
if ( redteam ) then -- If it was found (not false) | if ( redteam ) then -- If it was found (not false) | ||
setPlayerTeam ( source, redteam ) | |||
end | end | ||
end | end |
Revision as of 22:45, 7 January 2008
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) setPlayerTeam ( 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